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. Advertisements

  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. Advertisements

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. Titus A Ducksass
    Replies:
    1
    Views:
    6,187
    Sid Ismail
    Aug 1, 2003
  2. Tim Jones
    Replies:
    0
    Views:
    518
    Tim Jones
    Jan 31, 2004
  3. Replies:
    0
    Views:
    505
  4. Jimmy

    Why #pragma pack not take effect?

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

    Question about using #pragma pack

    Boltar, Mar 20, 2008, in forum: C Programming
    Replies:
    7
    Views:
    609
    Keith Thompson
    Mar 20, 2008
  6. Steven Woody
    Replies:
    9
    Views:
    785
    Steven Woody
    Jul 13, 2008
  7. Fedor Rodikov
    Replies:
    6
    Views:
    909
    James Kanze
    Sep 2, 2011
  8. Alexander Farber

    pack 'C3U*' not same as pack 'C3(xC)*'

    Alexander Farber, Jun 23, 2005, in forum: Perl Misc
    Replies:
    2
    Views:
    372
    Ilmari Karonen
    Jun 23, 2005
Loading...