Group: comp.lang.c++
From: Ian Collins
Date: Wednesday, April 09, 2008 3:58 PM
Subject: Re: C or C++

Ioannis Vranos wrote:
> Ian Collins wrote:
>> Ioannis Vranos wrote:
>>> 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.
>>>
>>> Have I forgotten anything?
>> Implicit int, missing function prototypes, use of const,
>
> Right, those too.
>
I wouldn't call any of the above "minor exceptions".

>> assignments to
>> enums...
>
> An example?
>
typedef enum { one, two } E;

E e = 42;

--
Ian Collins.