how does pragma pack work?

J

JustSomeGuy

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)
 
P

Pete Becker

JustSomeGuy said:
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)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top