C nunca foi um subconjunto de C ++. O exemplo mais óbvio disso é int new;
. Isto tem sido verdade desde C89 e C ++ 98, e as linguagens só cresceram mais umas nas outras à medida que novos padrões surgiram.
Should I stop using the term C/C++
Sim
If the answer to #1 is yes, how would I call a program that use a mix of C and C++?
Um arquivo de origem é escrito em um idioma ou outro. Um programa pode consistir em código de vários idiomas trabalhando juntos ou em um executável produzido pela vinculação de diferentes objetos compilados. Você diria que o programa foi escrito em C e C ++, "C / C ++" não é uma linguagem.
Given that both of them are 'different' languages is it likely that at some point C++ compilers stop supporting code written in the C language
3) Eles nunca fizeram. %código%. C e C ++ nunca foram totalmente compatíveis pelo menos desde que tenham padrões ISO (não sei todos os detalhes sobre os dias pré-padronizados). clique nos links ou veja abaixo um arquivo que está bem com C89 e acima, mas não é válido sob nenhum padrão C ++.
4) afaik não, os grupos de trabalho estão cientes um do outro, mas os padrões tomam as decisões que são melhores para si mesmos.
/* A bunch of code that compiles and runs under C89 but fails under any C++ */
/* type aliases and struct names occupy separate namespaces in C, not in C++ */
struct S { int i; };
typedef int S;
struct Outer { struct Inner { int i; } in; };
/* struct Inner will be Outer::Inner in C++ due to name scope */
struct Inner inner;
/* default return type of int in C, C++ functions need explicit return types */
g() {
return 0;
}
/* C sees this as two declarations of the same integer,
* C++ sees it as redefinition */
int n;
int n;
/* K&R style argument type declarations */
void h(i) int i; { }
/* struct type declaration in return type */
struct S2{int a;} j(void) { struct S2 s = {1}; return s; }
/* struct type declaration in argument, stupid and useless, but valid */
/*void dumb(struct S3{int a;} s) { } */
/* enum/int assignment */
enum E{A, B};
enum E e = 1;
void k() {
goto label; /* C allows jumping past an initialization */
{
int x = 0;
label:
x = 1;
}
}
/* () in declaration means unspecified number of arguments in C, the definition
* can take any number of arguments,
* but means the same as (void) in C++ (definition below main) */
void f();
int main(void) {
f(1); /* doesn't match declaration in C++ */
{
/* new is a keyword in C++ */
int new = 0;
}
/* no stdio.h include results in implicit definiton in C. However,
* as long as a matching function is found at link-time, it's fine.
* C++ requires a declaration for all called functions */
puts("C is not C++");
{
int *ip;
void *vp = 0;
ip = vp; /* cast required in C++, not in C */
}
return 0;
}
/* matches declaration in C, not in C++ */
void f(int i) { }
Eu sempre sinto que vale a pena mencionar que C é um subconjunto do Objective-C.