This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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] |
Hello, A previous patch (http://sources.redhat.com/ml/libc-alpha/2003-03/msg00379.html) to stop the type punning errors in this file with gcc 3.3 was shown to be incorrect, but it is still annoying me. As I understand it, gcc warns when you do something i; void *ptr = &i; void **ptr2ptr = &ptr; somthing **ptr2 = (somthing **)ptr2ptr <- warning because if you dereference ptr2ptr it's really void *, but gcc (and probably the developer) would assume it's a something * and hence you are in danger of accessing the same memory as two different types, which breaks the type based aliasing rules. i think by using a union you are explictly specifying your punning, so gcc can know what you are up to and take account accordingly. -i ianw at gelato dot unsw dot edu dot au http://www.gelato.unsw.edu.au
Attachment:
ctype.union.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |