A89: Re: Re: tigcc - some REAL routines this time [OT]
[Prev][Next][Index][Thread]
A89: Re: Re: tigcc - some REAL routines this time [OT]
> I remembered that C _was_ a subset of C++, but couldn't remember
> where it was I read it so I looked around. Well, I found two books
> that agree.
C is NOT a subset of C++, although 99% of C is a subset of C++.
Example 1: In C, a function need not to have a prototype if the
return type is int, and if all arguments are int. in C++, each
function MUST have a prototype.
Example 2: C++ has stronger type checking. The following is legal
in C, but not in C++:
enum Bool {FALSE,TRUE};
enum Bool MyVar;
MyVar = 1;
At least, you will get a warning instead of error. C++ needs
MyVar = (Bool)1;
e.g. an explicite typecast if you want to assign integer to enum
type.
There are also more examples (incompatibilities in a pointer
assignments), but I can't remember them just at the moment...
Zeljko Juric
Follow-Ups: