Seebs wrote:
....
I would guess that almost no module of code I've written in the last decade
would compile as C++ without changes, because I use malloc and I don't cast
the result, because casting the result is actively stupid in C.
OK - that's a perfectly reasonable reason, and probably the single most
common issue that comes up. However, it's not, in itself, an indication
of a major incompatibility between the languages, and most of the other
incompatibilities cause much less trouble than that one. It doesn't come
up much in my code, possibly because most of the data I work with has a
fixed record size, which make the use of static and automatic data
storage much easier than it would be in other contexts.
....
... C trusts
the programmer; a thing which does not trust the programmer is not a better
C.
I think that depends entirely upon how well you can trust the programmer
to know what he's doing. I like C, because I do know what I'm doing. I'm
the C guru in my office; people come to me to help figure out how to
make their C code do what they wanted it to do. As a result, I've seen a
lot of C code written by people whose competence should not be trusted
as much a C does.
I'm not sure C++ is the answer, either. It has essentially all of the
complexities of C, and a whole bunch more of it's own. I'm nowhere near
as experienced in the use of C++ as I am in the use of C, but my limited
exposure to C++ has not been positive. It could be my own inexperience,
the poor quality of the code I was modifying, or the lack of
documentation, but I've always found it difficult to determine which
class and which member it is that should be modified to produce the
desired change in the program's behavior.