Group: comp.lang.c++
From: Ioannis Vranos
Date: Wednesday, April 09, 2008 3:16 PM
Subject: Re: C or C++

Ian Collins wrote:
> Ioannis Vranos wrote:
>> Carmen Sei wrote:
>>> if I need to write C++, I will be forced to learn C automatically?
>>>
>>> Since I saw many C++ code need to call C library also.
>>>
>>> Most program use a combination of C++ code and calling C functions.
>>>
>>> Then writting C++, I cannot avoid learning C right?
>>
>> With minor exceptions C95 (ISO/IEC 9899:1995) is a subset of C++
>> (ISO/IEC 14882:2003).
>
> No, they are not "minor exceptions".


Supposing you are not talking about the word "exception", the exceptions
I know are the following:


1. Not implicit void * to any other pointer type conversion, as in C95.
2. 'a' is a char in C++ and not an int as in C95.
3. 0 is to be preferred than NULL, which does not apply to C95.
4. POD types can be considered as char/unsigned char sequences in C++,
but only as unsigned char sequences in C95.
5. Empty parentheses in function declarations/definitions are equivalent
to void in C++, but is a different thing in C95.


(6?) The following is guaranteed to not compile in C95, but it compiles
in my C++ compiler, but I am not sure if it is a difference or a
compiler-thing:


int main(void)
{
register char array[]= "Test";

char *p= array;

return 0;
}


Have I forgotten anything?

Safety Articles | Usenet Groups | Usenet News | Bluegrass