declare structure w/ mix alignment in project..

Discussion in 'C++' started by nm, May 4, 2006.

  1. nm

    nm Guest

    I create new prj w/ MSVC++ 6. This prj have compiler's option : Default
    struct alignment == 8 /Zp8

    so i don't know how do i declare myStruct w/ no alignment (align(1)).

    i declared
    __declspec(align(1)) struct tagMAB_CODE_HEADER{
    uint8 iID;
    uint8 iSection[8];
    uint16 iLength;
    uint8 iCmdID;
    uint8 iResponse;
    } ;

    typedef struct tagMAB_CODE_HEADER MAB_CODE_HEADER;

    but it's not work ?

    nm.
     
    nm, May 4, 2006
    #1
    1. Advertising

  2. nm wrote:
    > I create new prj w/ MSVC++ 6. This prj have compiler's option :
    > Default struct alignment == 8 /Zp8
    >
    > so i don't know how do i declare myStruct w/ no alignment (align(1)).
    >
    > i declared
    > __declspec(align(1)) struct tagMAB_CODE_HEADER{
    > uint8 iID;
    > uint8 iSection[8];
    > uint16 iLength;
    > uint8 iCmdID;
    > uint8 iResponse;
    > } ;
    >
    > typedef struct tagMAB_CODE_HEADER MAB_CODE_HEADER;
    >
    > but it's not work ?


    Is that a question? Alignment is platform-specific and things like
    '__declspec' are compiler-specific. As such they are OT here. Please
    ask in 'microsoft.public.vc.language'.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, May 4, 2006
    #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. mosfet
    Replies:
    1
    Views:
    410
    lallous
    Dec 15, 2003
  2. sharat
    Replies:
    5
    Views:
    390
    John Carson
    Dec 17, 2006
  3. Rose

    declare structure

    Rose, Mar 9, 2008, in forum: Perl Misc
    Replies:
    1
    Views:
    87
    Ben Morrow
    Mar 9, 2008
  4. PerlFAQ Server

    FAQ 7.8 How do I declare/create a structure?

    PerlFAQ Server, Feb 12, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    107
    PerlFAQ Server
    Feb 12, 2011
  5. PerlFAQ Server

    FAQ 7.8 How do I declare/create a structure?

    PerlFAQ Server, Feb 22, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    101
    PerlFAQ Server
    Feb 22, 2011
Loading...

Share This Page