-
May 19th, 2011, 10:55 AM
#16
Re: union
Originally Posted by ninja9578
I didn't say that the example I posted was that case, I was just saying that it's a more advanced case, that might be undefined.
What would happen here?
Code:
union foo {
bool b;
short s;
int i;
};
Is it defined where the bits for each are stored, or is that up to the compiler?
I believe that's compile dependent. I think...
Viggy
-
May 19th, 2011, 03:32 PM
#17
Re: union
As I read this http://www.open-std.org/jtc1/sc22/wg...2011/n3242.pdf (page 226, §5) each member in a union should have the same address so the mapping is defined. Endian has to be considered though.
-
May 19th, 2011, 03:50 PM
#18
Re: union
That's right, each member in the union starts at the same address.
Viggy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|