Document empty structures

Fergus Henderson fjh@cs.mu.OZ.AU
Mon Apr 14 03:43:00 GMT 2003


On 11-Apr-2003, Geoffrey Keating <gkeating@apple.com> wrote:
> Index: doc/extend.texi
...
> +@node Empty Structures
> +@section Structures With No Members
> +@cindex empty structures
> +@cindex zero-size structures
> +
> +GCC permits a C structure to have no members:
> +
> +@example
> +struct empty @{
> +@};
> +@end example
> +
> +The structure will have size zero.  In C++, empty structures are part
> +of the language, and the language standard says they have size 1.

I'm pretty sure that the C++ language standard does not say that empty
structures have size 1 -- AFAIK it just says that they have non-zero size
(C++98 section 9, paragraph 3).

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc-patches mailing list