Exemple where TYPE_ALIGNMENT() fails

Posted by JustMaximumPower on Stack Overflow See other posts from Stack Overflow or by JustMaximumPower
Published on 2010-03-29T12:51:23Z Indexed on 2010/03/29 12:53 UTC
Read the original article Hit count: 256

Filed under:
|
|
|

Hi,

I have a question relating to alignment in c/c++. In http://stackoverflow.com/questions/364483/determining-the-alignment-of-c-c-structures-in-relation-to-its-members Michael Burr posted this Makro:

#define TYPE_ALIGNMENT( t ) offsetof( struct { char x; t test; }, test )

in the comments someone wrote this might fail with non POD typs. Can someone give me an code example where this fails?

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++