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: Empty structures: Legal as GNU extension?


Nathan Myers <ncm@cygnus.com> said:
> Horst von Brand wrote:
> > It just so happens that the Linux kernel uses empty structures [...]

[...]

> If support for empty structs isn't documented, it might go away.

That's exactly what I am worried about.

> Empty structs are allowed in Standard C++, but might not be really empty.
> In Egcs-1.1, with -fnew-abi, they are whenever it's allowed.  (Two objects 
> of the same type can't have the same address, so sometimes padding is 
> needed.)  Of course this fact isn't very useful for Linux kernel coding 
> *quite* yet.  Next year, who knows?

If C++ allows the Linux kernel use (which is exactly as you describe), it
should be easy to keep it as a C++-like extension, like inline functions
are. They do share most of their code with C++, don't they? (Yes, I do know
that inline functions are vastly more useful and much harder to do than
what I'm asking for).
-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513



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