Article View: comp.std.c
Article #1180Re: Zero-length structures and pointer comparisons
From: John F. Woods
Date: Tue, 08 Sep 1992 21:39
Date: Tue, 08 Sep 1992 21:39
10 lines
790 bytes
790 bytes
fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
>First, a question for comp.std.c:
>is the following a legal (strictly conforming) program?
> struct S { unsigned:0; }
> int main() { return sizeof(S); }
No. "If the struct-declaration-list contains no named members, the behavior
is undefined." This is not a Constraint, so no message is required by the
Standard; the compiler can do something arbitrarily cruel and stupid without
even giving a hint as to what it is up to :-).
Technical Details
Message-ID:
<15604@ksr.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfwReferences:
<9225302.22791@mulga.cs.mu.OZ.AU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfw From: jfw@ksr.com (John F. Woods) Newsgroups: comp.std.c Subject: Re: Zero-length structures and pointer comparisons Message-ID: <15604@ksr.com> Date: 8 Sep 92 17:39:12 EDT References: <9225302.22791@mulga.cs.mu.OZ.AU> Sender: news@ksr.com Lines: 11