Subj : Re: year 11 maths survey To : comp.programming From : Rob Thorpe Date : Sun Sep 11 2005 01:07 pm Jon Harrop wrote: > Richard Heathfield wrote: > > I would. A well-written C++ program which takes advantage of common C++ > > idioms is effectively unreadable to anyone who knows C but not C++. > > Yes. > > >> C programmers can use C++ compilers. > > > > Sure, if they want to write C++. > > Or if they want to write C. I often compile C using a C++ compiler without > any trouble. > > > COBOL programmers can do the same. But, > > whilst it is true that some of my C programs will compile under a C++ > > compiler, many do not. And a few that do compile will have different > > semantics under C++ than they do under C. > > Then you're probably overusing trigraphs! ;-) There are several difference between C and C++, the precedence order is slightly different for example. The most common problem is the meaning of the void pointer which is quite different in C to C++. If you write: x = malloc(sizeof(x_t)); That is considered fine by many C programmers (including me). It's not right in C++ and without a cast it will at least cause a warning. Compile a large C program with a C++ compiler and you get at least a slew of warning, and normally errors. .