R
.rhavin grobert
let say i have
struct SA {
long l1;
long l2:
long l3;
};
struct SB: public SA {
long l4;
};
SB test;
- - - - - -
is is save to do the following...
void* pl3 = ((long*) &test) + 2
void* pl4 = ((long*) &test) + 3
.... to get pointers to l3 and l4?
i'm asking because it works (on my visual c compiled code at least)
but i wanna know
if i can always guess that the above structures will be in memory this
way:
[ long l1 ][ long l2 ][ long l3 ][ long l4 ]
is this any behaviour that is defined in c++ or is it system-
dependent?
thx for any thoughts, -.rhavin
struct SA {
long l1;
long l2:
long l3;
};
struct SB: public SA {
long l4;
};
SB test;
- - - - - -
is is save to do the following...
void* pl3 = ((long*) &test) + 2
void* pl4 = ((long*) &test) + 3
.... to get pointers to l3 and l4?
i'm asking because it works (on my visual c compiled code at least)
but i wanna know
if i can always guess that the above structures will be in memory this
way:
[ long l1 ][ long l2 ][ long l3 ][ long l4 ]
is this any behaviour that is defined in c++ or is it system-
dependent?
thx for any thoughts, -.rhavin