bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Bruno Haible <bruno@clisp.org>,
	bug-gnulib@gnu.org, Khem Raj <raj.khem@gmail.com>
Subject: Re: [PATCH] Define alignof_slot using _Alignof when using C11 or newer
Date: Sat, 14 Jan 2023 17:59:12 -0800	[thread overview]
Message-ID: <f3b2b750-bbf9-703b-b295-88bd379c4afc@cs.ucla.edu> (raw)
In-Reply-To: <4385269.dumfJixkPq@nimes>

On 2023-01-14 16:17, Bruno Haible wrote:
> What's (quasi) normative is
> 
>    * n3047.pdf = C23, which says in 7.21.(3)
>      "If the specified type defines a new type or if the specified member is
>       a bit-field, the behavior is undefined."

I'm afraid this wording in n3047 is unclear. Ordinarily one would look 
at n3047's section "Type definitions" to interpret the phrase "defines a 
new type", but as that section merely talks about typedefs it doesn't 
seem to be relevant here. I can't find any part of the standard that 
talks about "defining a new type".

All the standardizers wanted here is for the TYPE to not contain a 
top-level comma in 'offsetof (TYPE, MEMBER)' because that would screw up 
macro argument identification.

I hope Clang 16 is not reporting an error for 'offsetof (struct {char a; 
int b;}, b)'; if so, it's gone off the deep end. A nameless struct does 
not "define a new type" for some reasonable definitions of the term 
"define a new type", and since the standard doesn't define that term the 
Clang developers should be cautious about diagnostics in this messy area 
when a lot of code out there uses offsetof in precisely this way.


      parent reply	other threads:[~2023-01-15  1:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14 23:27 [PATCH] Define alignof_slot using _Alignof when using C11 or newer Khem Raj
2023-01-15  0:17 ` Bruno Haible
2023-01-15  1:20   ` Khem Raj
2023-01-15  1:59   ` Paul Eggert [this message]

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

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

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

  git send-email \
    --in-reply-to=f3b2b750-bbf9-703b-b295-88bd379c4afc@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=raj.khem@gmail.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 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).