All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: manfred@colorfullife.com, anton@samba.org,
	linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: [PATCH] 2.5 fast poll on ppc64
Date: Thu, 26 Dec 2002 16:14:44 -0800	[thread overview]
Message-ID: <20021226161444.A21658@twiddle.net> (raw)
In-Reply-To: <200212262055.VAA28874@harpo.it.uu.se>; from mikpe@csd.uu.se on Thu, Dec 26, 2002 at 09:55:15PM +0100

On Thu, Dec 26, 2002 at 09:55:15PM +0100, Mikael Pettersson wrote:
> >I would agree, but there is a special restriction on offsetof() and 
> >sizeof() of structures with flexible array members: section 6.7.2.1, 
> >clause 16:
> >
> >First, the size of the structure shall be equal to the offset of the
> >last element of an otherwise identical structure that replaces the
> >flexible array member with an array of unspecified length.
[...]
> Oh dear. I checked my C9x draft copy and you seem to be right.
> The standard states that sizeof(struct a1) == offsetof(struct a1, c),
> but both gcc (2.95.3 and 3.2) and Intel's icc (7.0) get it wrong on x86:
> they make sizeof(struct a1) == 8 but offsetof(struct a1, c) == 6.

Indeed, *every* compiler that supports flexible array members
does it this way.  On the gcc lists we've conjectured that this
will wind up being a Defect Report, and so have elected not to
change anything for the nonce.

That said, you should also note that "struct S foo[0]" is *not*
a flexible array member; "struct S foo[]" is.  The former is
gcc's zero-length array extension.  There are subtle differences
between the two features.  See the gcc docs for details.


r~

  parent reply	other threads:[~2002-12-27  0:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-26 20:55 [PATCH] 2.5 fast poll on ppc64 Mikael Pettersson
2002-12-26 21:23 ` Linus Torvalds
2002-12-26 21:42 ` Manfred Spraul
2002-12-27  0:14 ` Richard Henderson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-26 12:57 Mikael Pettersson
2002-12-26 13:53 ` Manfred Spraul
2002-12-26  6:48 Anton Blanchard
2002-12-26 12:09 ` Manfred Spraul

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=20021226161444.A21658@twiddle.net \
    --to=rth@twiddle.net \
    --cc=anton@samba.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=mikpe@csd.uu.se \
    --cc=torvalds@transmeta.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.