On Sun, Jul 1, 2012 at 6:32 PM, Charles Forsyth
<[email protected]>wrote:

> Yes, I was assuming the same approach as for the existing void data
> declaration, that the structure is given a nominal size,
> for just the reasons you give.  (That's what gcc seems to do.)
>
> On 1 July 2012 23:22, Comeau At9Fans <[email protected]> wrote:
>
>> Many compilers do just that, however, that said, unless the compiler is
>> prepared for it, since it effectively yields a struct of zero size which
>> normally is a no-go, it could produce bugs involving sizeof, initializers,
>> pointer addition et al, even some divisions by zero if the compiler is
>> making certain assumptions already, unless it already can have zero length
>> objects of this nature for some other reasons.
>
>
Actually gcc gives it (the empty struct) sizeof zero (same as for its zero
length arrays).  Comeau mimics that behavior in gcc-mode, but used to/still
can also generate a dummy internal member too (usually a char bringing
forth sizeof 1).

-- 
Greg Comeau / 4.3.10.1 with C++0xisms now in beta!
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

Reply via email to