Re: C structure padding

msb@sq.sq.com (Mark Brader)
Tue, 29 Jun 1993 04:21:57 GMT

          From comp.compilers

Related articles
Permuting fields of records garavel@imag.fr (1993-06-04)
C structure padding drw@zermelo.mit.edu (1993-06-26)
Re: C structure padding pat@tesuji.qc.ca (1993-06-27)
Re: C structure padding lord+@andrew.cmu.edu (Tom Lord) (1993-06-27)
Re: C structure padding jqb@netcom.com (1993-06-27)
Re: C structure padding drw@phragmen.mit.edu (1993-06-28)
Re: C structure padding jqb@netcom.com (1993-06-28)
Re: C structure padding msb@sq.sq.com (1993-06-29)
| List of all articles for this month |
Newsgroups: comp.compilers
From: msb@sq.sq.com (Mark Brader)
Keywords: C
Organization: SoftQuad Inc., Toronto, Canada
References: 93-06-012 93-06-066
Date: Tue, 29 Jun 1993 04:21:57 GMT

Dale R. Worley (drw@zermelo.mit.edu) writes:
> This leads up to a point that I've never seen satisfactorily resolved:
> Must a structure be padded when it is *not* part of an array? I've never
> seen anything in the Standard that makes it clear that such a structure
> must be padded, bit it seems clear that padding is necessary for common
> programming paradigms to work. Am I missing something?


> [It's pretty clear that all structures have to be treated the same, since
> if p and q are pointers to structures, you can write *p = *q regardless of
> whether they're pointing to simple structures or into an array. -John]


Right. Chapter and verse: section 3.5.2.1 (ANSI) / 6.5.2.1 (ISO),
Semantics, last paragraph, my emphasis added.


# There may also be unnamed padding at the end of a structure or union,
# as necessary to achieve the appropriate alignment *WERE* the structure
# or union to be an element of an array.


I may as well point out here the existence of comp.std.c, which is
specifically for topics about the C standard. If Dale had posted there,
he or she would no doubt have received half a dozen responses from people
familiar with the above text (followed, of course, by a minor flame war,
under the same Subject line, about some tangential topic or other...).
--
Mark Brader
SoftQuad Inc., Toronto
utzoo!sq!msb, msb@sq.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.