ucontext_t wrong size if C++ headers included first?
ucontext_t wrong size if C++ headers included first?
- Subject: ucontext_t wrong size if C++ headers included first?
- From: Sidney San MartÃn <email@hidden>
- Date: Thu, 19 Sep 2013 14:08:16 -0400
Check out this C++ program:
// #include <iostream>
#define _XOPEN_SOURCE 1
#include <ucontext.h>
int main () {
printf("sizeof(ucontext_t) -> %ld\n", sizeof(ucontext_t));
}
On my machine, it prints "768" (big ol' CPU). But, if I uncomment
"#include <iostream>" and recompile, it prints "56". In practice, this
makes getcontext() and the like overrun ucontext_t structs and stomp
on other memory.
If I define _XOPEN_SOURCE *before* I include iostream, ucontext_t is
the right size. What's going on here?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden