This is the mail archive of the cygwin mailing list for the Cygwin 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]

Re: Cygwin struct alignment


----- Original Message ----- From: "John Emmas"
Subject: Cygwin struct alignment

I'd assumed that Cygwin probably wouldn't use structure packing (only because I don't think Linux does). But I only get meaningful data with 8-byte packing. It looks as if Cygwin's compiler must default to 8-byte packing too. Does that make sense?

Actually, this is turning out to be slightly more complicated than
I thought.  Member alignment for very simple structs seems to correlate
pretty well but more complex structs cause subtle (though hopefully not
insurmountable) problems..

'bool' seems possibly to be a caveat (bool uses 4 bytes in MSVC but I don't
know how many bytes it uses in Cygwin).  Also, structs that contain arrays
don't quite line up between the two compilers.  In both cases, the total
size for a struct is usually bigger than the calculated size (i.e. the size
it would be if there was no member alignment) but Cygwin's seem generally to
be slightly larger than Microsoft's.

Is it possible (in Cygwin) to disable structure packing?  (I know this is
possible for MSVC).  Also, is there a handy reference where I could find out
more about the format and 'size' of basic Cygwin types?  Most of them are
obvious of course, but there are a few less obvious ones, like 'bool',
'float'  and 'enum' types.  I could also do with checking that the encoding
format for floats is compatible between the two compilers - or is it
processor dependent?  If I don't check, I'm bound to come unstuck (I'm
compiling for a 32-bit platform BTW).

Anywhere I can find out this kind of stuff??

And a happy Christmas to everyone !

John


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]