This is the mail archive of the
mailing list for the GCC project.
Re: how to get the field_id for member of structure in gcc front end
On Mar 29, 2006, at 12:15 AM, Tianwei Sheng wrote:
but it's my be too aggressive. as you said, you mean "base,ofst"
rule is enough,
a more safe method is "base,ofst, lenght" rule.
Right. I didn't mean to exclude length, just that I didn't expound
on the idea, as I wanted to get the simple concept across; there are
any small details that have to be perfect for it to work, length is
but one of them.
int *p = &pair.a
int *q = &pair.a;;
p = p+1;
*p = 1;
*q = 2;
(*p) and (*q) are not aliased because of p = p +1; now p points to
a + 0 != a + 0 + 8
I just didn't want you to do:
&pair.a + 1 != &pair.b
because .a != .b because the `names' don't match. By comparing the
offset, we `know' that the bytes in positions 0-3 can't be the same
as the bytes if positions 4-7, it just isn't possible.