Sign in to follow this  

GCC pack/align compatibility

This topic is 4544 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I havent used Linux much (as yet), but had seen talk about problems with data alignment within structs (where many compilers force alignment to 2 or 4 byte on 'int' etc..). I have a project written on a MS OS using VC++6 which has pack(1) to save space on large data structures. I want to offload some number crunching on a simulation onto a cluster of additional PC class machines (likely to be Linux based to save $$$) and would like to have to do only minor changes to the data structures (and share the common struct definition files if possible). Is the Pack/Align a problem only if the program is intentionally written to be platform independant??? Ive done some looking at the cloud of compiler parameters that GCC has and I think it indicates that it can be set to the equivalent of pack(1). Is this a correct assumption??? All machines will be intel compatible so at least byte order wont be a problem. I normally write C++ as if it was C, so I also hope that most of the data access routines' source (hash heaps etc..) and UDP comm stuff can also be used without changes (to avoid maintaining parallel source codes ). Edit - Hmmm, Thread stuff tho, will have to be modified.

Share this post


Link to post
Share on other sites
The pack/align problem is an issue if you make assumptions about the size or position of the structure members. If the only reason you did packing was to save space, then it's unlikely to be an issue. But I'm sure you can set up the packing to be the same in GCC anyway.

Share this post


Link to post
Share on other sites
Sign in to follow this