This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]