Article View: comp.std.c
Article #82Re: Character arrays in structures and address alignment -- any standard?
From: John F. Woods
Date: Mon, 03 Aug 1992 18:14
Date: Mon, 03 Aug 1992 18:14
38 lines
1916 bytes
1916 bytes
volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe) writes:
>There are no "two interpretations". That's the whole point. The "other
>interpretation" was shot down by the strictly conforming program that
>prints different results under the non-literal interpretation.
No. The program given was strictly conforming if and only if the "implied"
forbidding of "unnecessary" padding is real. I claim that there is nothing
in the rest of the Standard that allows one to deduce this (unlike the "all
structure pointers are the same size" rule), and that the words "may not" do
not appear in either
"There may be unnamed padding within a structure object, but not
at its beginning, as necessary to achieve the appropriate alignment."
or
"When applied to an operand that has structure or union type, the
result is the total number of bytes in such an object, including
internal and trailing padding."
except, of course, to forbid padding at the beginning of structures.
"I claim that the Standard requires char objects to be exactly 8 bits, and
prove it with the following strictly conforming program:
#include <limits.h>
#include <stdio.h>
main() {
printf("%d\n", CHAR_BITS);
exit(0);
}
which prints 8 in all conforming implementations."
That is true if and only if the fantasy requirement exists.
As I said, whoever wrote the Rationale also appears to believe that structures
may have internal padding that strict parsimony would reject.
Technical Details
Message-ID:
<14382@ksr.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfwReferences:
<Bs5pMJ.3nM@twwells.com> <7022@skye.ed.ac.uk> <1992Jul31.010941.7282@crd.ge.com> <7039@skye.ed.ac.uk> <1992Aug3.005338.1488@crd.ge.com>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: Character arrays in structures and address alignment -- any standard? Message-ID: <14382@ksr.com> Date: 3 Aug 92 14:14:35 EDT References: <Bs5pMJ.3nM@twwells.com> <7022@skye.ed.ac.uk> <1992Jul31.010941.7282@crd.ge.com> <7039@skye.ed.ac.uk> <1992Aug3.005338.1488@crd.ge.com> Sender: news@ksr.com Lines: 38