Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why do you say that compiling C is "mostly out the window"? It's difficult to imagine how C++ could change in a way that broke C compatibility without also breaking compatibility with a great deal of C++ code.


C++ isn't compatible C, it never was. There's lots of valid C code that isn't valid C++. For instance, this line:

    int *new = malloc(sizeof(int));
is valid C but invalid C++ for two different reasons: "new" is a keyword in C++, so you can't use it as an identifier, and C++ doesn't allow implicit casts from void*, while C does.


int new = old + 5;

:)


Oh, sure, and the void pointer thing, etc., but that's all been true from the start. From gumby's comment I got the impression that there might be some more recent trend toward abandoning C compilation, and that's what I have a hard time imagining.


For years, Microsoft's C compiler only supported C89 and would choke on C99 code (that used C99 features). That has recently changed (I'm guessing with the release of C11, which made certain C99 features optional instead of mandatory) but for a long time, it seemed that Microsoft was saying "We don't care about C."


That's basically what I mean: both the C++ and C committees have been OK with C++ not being a proper superset of C.

The reason I mentioned it is that some of the syntactic horrors of C++ could safely be thrown out the window these days.

BTW though I'm primarily still a Lisp programmer I do like C++


It's true that the C circle in the Venn diagram leaks out of the C++ circle a bit, but I find in practice most of it is contained quite well inside the C++ one.

My current hobby project is a language VM that compiles cleanly as both C and C++. It took very little effort to get it working in C++ despite hacking on it for months as a strictly C project first.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: