public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Richard Frith-Macdonald <richard@brainstorm.co.uk>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: c/10360: __alignof__(double) answer 8
Date: Thu, 10 Apr 2003 05:16:00 -0000	[thread overview]
Message-ID: <20030410051600.14728.qmail@sources.redhat.com> (raw)

The following reply was made to PR c/10360; it has been noted by GNATS.

From: Richard Frith-Macdonald <richard@brainstorm.co.uk>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-gnats@gcc.gnu.org, thoran@free.fr, nobody@gcc.gnu.org,
   gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, discuss-gnustep@gnu.org,
   rth@gcc.gnu.org, Frederic De Jaeger <dejaeger@free.fr>
Subject: Re: c/10360: __alignof__(double) answer 8
Date: Thu, 10 Apr 2003 06:06:44 +0100

 On Wednesday, April 9, 2003, at 11:40  pm, Richard Henderson wrote:
 
 > On Wed, Apr 09, 2003 at 11:59:58PM +0200, Frederic De Jaeger wrote:
 >> Thus, why gcc does not align fields with respect to this *preferred*
 >> alignment?
 >
 > Because the ABI says not to.
 
 It would be interesting to know in what sense the alignment is 
 'preferred'.
 Surely if the 'ABI says not to' then the alignment is not preferred?
 
 >> ... and we expect it to return the alignment used by the compiler 
 >> (and not
 >> the *preferred* alignment).
 >
 > A meaningless number.  Because "the alignment used by the compiler"
 > is going to depend on the context in which it is used.
 
 I think that Frederic means the alignment the compiler uses to lay out
 structures in memory.
 
 It's hard to see how that can be context sensistive since the compiler
 needs to know it to access the structure elements via a pointer, so
 the code that stored the structure in memory and the code that
 retrieves it through the pointer have to use the same alignments.
 
 I imagine this is *by far* the most common context in which anyone
 would want to know a type alignment (actually it's the only one I can
 think of off hand).
 
 So if __alignof__ is not returning the alignment of a type for structure
 layout, how can it be returning the 'preferred' alignment.  Shouldn't 
 this
 either be fixed as Frederic suggests, or the documentation be changed
 so that instead of saying 'preferred' it says 'misleading and largely
 useless'
 
 Sorry if this sounds overly aggressive, but I do think that compiler 
 extensions
 should be useful and behave as expected, and this behavior seems to
 mean that __alignof__ fails in this.
 


             reply	other threads:[~2003-04-10  5:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10  5:16 Richard Frith-Macdonald [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-10  8:06 Richard Henderson
2003-04-09 22:46 Richard Henderson
2003-04-09 22:06 Frederic De Jaeger
2003-04-09 17:29 rth
2003-04-09  9:06 thoran

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=20030410051600.14728.qmail@sources.redhat.com \
    --to=richard@brainstorm.co.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).