struct and members addresses

Cédric Lucantis cedric.lucantis@caramail.com
Thu Apr 24 11:01:00 GMT 2003


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




More information about the Gcc-help mailing list