[cfe-dev] #ifndef not working
Patrick Flannery
foster_flannery at yahoo.com
Wed Aug 29 12:50:57 PDT 2007
The following code will cause a segfault.
#include "/usr/lib/gcc/xb6_64-redhat-linux/4.1.1/include/stddef.h"
#ifndef offsetof
#define offsetof (TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
struct external_sun3_core
{
size_t c_regs;
};
struct internal_sunos_core
{
size_t c_regs_pos;
size_t c_regs_size;
};
static void swap(char * ext, struct internal_sunos_code *intcore)
{
struct external_sun3_core * extcore = (struct external_sun3_core *) ext;
intcode->c_regs_pos = offsetof(struct external_sun3_core, c_regs);
}
Patrick
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20070829/ce822b2f/attachment.html>
More information about the cfe-dev
mailing list