Connecting Tech Pros Worldwide Forums | Help | Site Map

how does pragma pack work?

JustSomeGuy
Guest
 
Posts: n/a
#1: Jul 22 '05
I need to define a structure that is byte packed.
I was planning on using #pragma pack (1)

So when does the pragma pack end right after the first structure definition
or
at the end of the header file or until a new pragma pack is encountered...

This need to work for visual c++ as well as g++ (gnu cpp 3.3)



Pete Becker
Guest
 
Posts: n/a
#2: Jul 22 '05

re: how does pragma pack work?


JustSomeGuy wrote:[color=blue]
>
> I need to define a structure that is byte packed.
> I was planning on using #pragma pack (1)
>
> So when does the pragma pack end right after the first structure definition
> or
> at the end of the header file or until a new pragma pack is encountered...
>
> This need to work for visual c++ as well as g++ (gnu cpp 3.3)[/color]

Check the g++ documentation to see what they do with this pragma. Check
the VC++ documentation to see what they do with this pragma. They might
be the same, but they might not. pragmas aren't standardized.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
Closed Thread