This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [C++ PATCH] warning about empty extern "C" structures


On Wed, May 17, 2006 at 09:01:26PM +0200, Gabriel Dos Reis wrote:
> Oleg Ostrozhansky <oleg@olegos.com> writes:
> 
> | g++ and gcc, and by itself is not likely to be an error.  But the
> | extern-C construct indicates that the following C++ code will be used
> | with C,
> 
> that premise is wrong.  
> 
> Constructs in extern "C" are full C++; you don't seriously propose we
> start warning on exceptions and the like -- which are not C.

I don't know.  Maybe in the future, if/when there is a need for it.
There is a definite need for the empty structure warning -- see
the Linux kernel mailing list.

> Roman Kononov <kononov195-far@yahoo.com> writes:
> 
> | On 05/17/2006 13:13, Mark Mitchell wrote:
> | > So, I don't think we have any choice about the semantics.  We could,
> | > however, issue a warning, in either or both of the C/C++ front-ends, but
> | > I'm not sure how valuable that would be; I think we'd get a lot of false
> | > positives in ordinary C++ code, which tends to use empty structures
> | > frequently.
> | 
> | Such warning would be a false positive in ordinary C++ code only if the
> | code is inside extern "C", which is unusual.
> 
> "unusual" only in some corner of the world.

Very large corner of the world.  And the rest of the world wouldn't use
this new switch.

  Oleg


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