This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What should alignof do with incomplete types?
- To: Jamie Lokier <jamie dot lokier at cern dot ch>
- Subject: Re: What should alignof do with incomplete types?
- From: Stan Shebs <shebs at apple dot com>
- Date: Tue, 07 Mar 2000 14:12:14 -0800
- CC: gcc at gcc dot gnu dot org
- Organization: Core Tools, Apple Computer
- References: <38C46CA0.4FEB5ADC@apple.com> <20000307132250.E6777@pcep-jamie.cern.ch>
- Reply-To: shebs at apple dot com
Jamie Lokier wrote:
> IMO an error is appropriate, just as for sizeof. Does Apple have code
> which depends on this being a just warning?
It appears not. I did a little digging in Apple's bug database, and the
problem was originally reported within NeXT in 1992(!). No code depending
on any particular behavior, it was just an observation that __alignof__
ought to warn about incomplete types, just as sizeof did at the time.
Quoting from the report: "Stallman does not consider this a bug and does
not plan to fix it". So then somebody at Apple added the warning locally.
The ironic part is that nowadays, sizeof on an incomplete type generates
an error! So I think it makes the most sense for __alignof__ to also
generate an error when used on incomplete types.
Stan