Re: casting of structs
From: Peter Pichler (pichlo7_at_pobox.sk)
Date: 12/29/03
- Next message: Kevin Goodsell: "Re: please comment"
- Previous message: Kevin D. Quitt: "Re: What kind of problems is c best at solving?"
- In reply to: Christopher Benson-Manica: "Re: casting of structs"
- Next in thread: Chris Torek: "Re: casting of structs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 29 Dec 2003 21:30:30 -0000
Christopher Benson-Manica wrote :
> Peter Pichler spoke thus:
>
> > No. A pointer to a structure can be portably /converted/ to a pointer to
the
> > first element of the structure and back.
>
> FMI, can you quote the portion of the Standard that allows this?
> Consider my curiousity piqued :)
Ehm, did I manage to make a fool of myself /again/? ;-)
No quote, just my simplified interpretation of 6.7.2.1:
...
13 Within a structure object, the non-bit-field members and the units in
which bit-fields reside have addresses that increase in the order in
which they are declared. A pointer to a structure object, suitably
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
converted, points to its initial member (or if that member is a
bit-field,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
then to the unit in which it resides), and vice versa. There may be
^^^^^^^^^^^^^^
unnamed padding within a structure object, but not at its beginning.
- Next message: Kevin Goodsell: "Re: please comment"
- Previous message: Kevin D. Quitt: "Re: What kind of problems is c best at solving?"
- In reply to: Christopher Benson-Manica: "Re: casting of structs"
- Next in thread: Chris Torek: "Re: casting of structs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|