9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Comeau At9Fans <comeauat9fans@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] cc nit?
Date: Sun,  1 Jul 2012 20:18:53 -0400	[thread overview]
Message-ID: <CAE9W7-hU25Su21yrzraZwTGkW1_Wans+jY_n4Em+VC3XrF9R8w@mail.gmail.com> (raw)
In-Reply-To: <CAOw7k5jae_Bxypz6QMsJ+2UOCX1ow2d4Lbm_PeMoyacEFGoNwQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]

On Sun, Jul 1, 2012 at 6:32 PM, Charles Forsyth
<charles.forsyth@gmail.com>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 <comeauat9fans@gmail.com> 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?

[-- Attachment #2: Type: text/html, Size: 1966 bytes --]

  parent reply	other threads:[~2012-07-02  0:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30 21:25 erik quanstrom
2012-06-30 21:33 ` Bakul Shah
2012-06-30 21:37   ` erik quanstrom
2012-06-30 22:15     ` Bakul Shah
2012-07-01 13:47       ` erik quanstrom
2012-07-01 16:54 ` Comeau At9Fans
2012-07-01 20:39   ` Charles Forsyth
2012-07-01 22:22     ` Comeau At9Fans
2012-07-01 22:32       ` Charles Forsyth
2012-07-01 22:34         ` Charles Forsyth
2012-07-02  0:21           ` Comeau At9Fans
2012-07-02  0:18         ` Comeau At9Fans [this message]
2012-07-02  7:42           ` Charles Forsyth
2012-07-02  7:45             ` Charles Forsyth
     [not found]     ` <CAE9W7-iFxd6ysP4cxRcGVuLT0n+SY2r4XjOTVpjpXi292v4WWQ@mail.gmail.c>
2012-07-01 22:45       ` erik quanstrom
2012-07-02  0:24         ` Comeau At9Fans
     [not found] ` <CAE9W7-gZsWHuspmwBw0qU_djkiDhAF6hA2zLU3Ms=xiO1j5LXQ@mail.gmail.c>
2012-07-01 16:57   ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE9W7-hU25Su21yrzraZwTGkW1_Wans+jY_n4Em+VC3XrF9R8w@mail.gmail.com \
    --to=comeauat9fans@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).