This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Data member with same name as enclosing class


>>>>> Matthias Urlichs <smurf@noris.de> wrote:

> Hi,
> Martin v. Loewis:
>> > extern "C" {
>> > struct ip_opts
>> >   {
>> >     struct in_addr ip_dst;
>> >     char ip_opts[40];
>> >   }
>> > ...
>> > } /* extern "C"  */
>> > 
>> [...]
>> > Question is: Should this error message be suppressed for 'extern
>> > "C"' structs or should the include file be changed ?
>> 
>> This is invalid C++, so it should be rejected.
>> 
> Hmm. It would be cool (even though The Standard probably prohibits it...)
> if g++ would automagically turn off all C++ features inside 'extern "C"',
> not just the name mangling...

It should be noted that code inside `extern "C"' *must* be valid
C++. `extern "C"' does not mean "hey, this is C not C++". `extern "C"'
has to do with linkage. Period. 

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]