This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
struct and members addresses
- From: Cédric Lucantis <cedric dot lucantis at caramail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 24 Apr 2003 13:00:45 +0100
- Subject: struct and members addresses
Hello
I would like to know if I can assume that a structure and its first member
will always have the same address. For instance, with the following code:
/* ----------------------------------*/
struct foo
{
any_type first_member;
};
struct foo my_struct;
void * addr1 = &my_struct;
void * addr2 = &my_struct.first_member;
/* ----------------------------------*/
can I be sure that `addr1' will be equal to `addr2' ?
thanks
______________________________________________________
Plus simple, plus fiable, plus rapide : Découvrez le nouveau Caramail - http://www.caramail.com