how does pragma pack work?

Discussion in 'C++' started by JustSomeGuy, Dec 9, 2003.

  1. JustSomeGuy

    JustSomeGuy Guest

    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)
     
    JustSomeGuy, Dec 9, 2003
    #1
    1. Advertising

  2. JustSomeGuy

    Pete Becker Guest

    JustSomeGuy wrote:
    >
    > 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.

    --

    Pete Becker
    Dinkumware, Ltd. (http://www.dinkumware.com)
     
    Pete Becker, Dec 9, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Jones
    Replies:
    0
    Views:
    401
    Tim Jones
    Jan 31, 2004
  2. Jimmy

    Why #pragma pack not take effect?

    Jimmy, Jul 3, 2007, in forum: C Programming
    Replies:
    5
    Views:
    794
    Kenny McCormack
    Jul 4, 2007
  3. Boltar

    Question about using #pragma pack

    Boltar, Mar 20, 2008, in forum: C Programming
    Replies:
    7
    Views:
    417
    Keith Thompson
    Mar 20, 2008
  4. Steven Woody
    Replies:
    9
    Views:
    601
    Steven Woody
    Jul 13, 2008
  5. Fedor Rodikov
    Replies:
    6
    Views:
    693
    James Kanze
    Sep 2, 2011
Loading...

Share This Page