Re: char data[0]
- From: pete <pfilandr@xxxxxxxxxxxxxx>
- Date: Fri, 13 Oct 2006 00:02:13 GMT
Bill Reid wrote:
Chris Dollin <chris.dollin@xxxxxx> wrote in message
news:eglkil$v0b$1@xxxxxxxxxxxxxxxxxxxxxxx
Bill Reid wrote:restrictive
As I learned the hard way (reading the FAQ) last night, structs are
actually "self-aligned" (translation: "start at") "by their most
2.12, "Additional Links"->Eric Raymond post:member", meaning the largest type in the struct (or this is how I
understand it).
Which bit of the FAQ reads like that?
On modern 32-bit machines like the SPARC or the Intel [34]86, or
any Motorola chip from the 68020 up, each data iten must usually be
``self-aligned'', beginning on an address that is a multiple of its type
size.
Thus, 32-bit types must begin on a 32-bit boundary, 16-bit types on a
16-bit boundary, 8-bit types may begin anywhere, struct/array/union
types have the alignment of their most restrictive member.
---end of excerpt
So as I take it, compilers on most 32-bit machines today set up
struct alignment based on
the aligment of "their most restrictive member".
Padding bytes, enable member alignment
to be independant of struct alignment,
except for the first member.
--
pete
.
- Follow-Ups:
- Re: char data[0]
- From: Harald van Dijk
- Re: char data[0]
- References:
- char data[0]
- From: aarklon
- Re: char data[0]
- From: jmcgill
- Re: char data[0]
- From: Keith Thompson
- Re: char data[0]
- From: Bill Reid
- Re: char data[0]
- From: Keith Thompson
- Re: char data[0]
- From: Bill Reid
- Re: char data[0]
- From: Keith Thompson
- Re: char data[0]
- From: Harald van Dijk
- Re: char data[0]
- From: Andrey Tarasevich
- Re: char data[0]
- From: Bill Reid
- Re: char data[0]
- From: Chris Dollin
- Re: char data[0]
- From: Bill Reid
- char data[0]
- Prev by Date: Re: Garbage Collection in C
- Next by Date: Re: [OT] purge like utility in c
- Previous by thread: Re: char data[0]
- Next by thread: Re: char data[0]
- Index(es):
Relevant Pages
|