Hey, Vincent Torri wrote: > >> Hey, >> >> i am porting a linux library which uses __attribute__((__packed__)) >> (compiled with gcc). >> >> I think that suncc allows, like vc++, the use of #pragma pack(1) to do the >> equivalent thing. >> >> I also read that __attribute__((__packed__)) is also supported on recent >> opensolaris versions. So: >> > > The "packed" attribute is available in Sun Studio 12 update 1, which is the > latest release. >
ok, thank you > >> 1) Is it really the case, and from which version >> __attribute__((__packed__)) is available (which version of _SUNPRO_C should >> I check) ? >> > > Check for __SUNPRO_C == 0x510 > hmm, in another answer about __attribute__, you told me to check __SUNPRO_C with 0x590. Is it still 0x510 ? > 2) is it better to use #pragma pack(1) instead of >> __attribute__((__packed__)) if the latter is available ? >> > > Personal preference, I suppose. #pragma pack(1) applies to all subsequent > struct/union definitions whereas the packed attribute must be applied to > each struct/union declaration. The packed attribute, though, can be used in > typedefs and then used to declare other variables needed by a program, which > is nice. > > In general, I'd say use the packed attribute ... it's a cleaner approach, > in my opinion. > that's what I'll use too. thank you for your answer ! Vincent Torri -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/tools-compilers/attachments/20090917/6b4d10c3/attachment.html>