• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [2.2] Cant get __attribute__ ((__packed__)) to work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [2.2] Cant get __attribute__ ((__packed__)) to work


  • Subject: Re: [2.2] Cant get __attribute__ ((__packed__)) to work
  • From: Dave Camp <email@hidden>
  • Date: Mon, 21 Nov 2005 10:59:08 -0800


On Nov 18, 2005, at 10:41 PM, Chris Espinosa wrote:

Um, I wouldn't think __packed__ to have any effect on the size of enum's.
Isn't it just applicable to struct [and maybe class] layout?

I verified that pragma options align doesn't change the enum size in gcc 4.0.1, but I tried the following code:


typedef enum __attribute__ ((__packed__))
{
foo  = 0x10
} fooEnum;

int main(const char argc, const char* argv) {
        printf("%d", sizeof(fooEnum));
}

and got the desired "1" instead of the default "4".

Changing foo to 0x10000000 got the result 4 again.

__attribute__ ((__packed__)) is known not to work prior to gcc 4.0.0, so if you have the 3.3 compiler set, that may be your problem.

I was trying gcc 4.0.1 (this was going to be an Intel port). That code did work in 2.95, and the 4.0 docs indicate it should work on typedef'd enums. In any event, it sounds like it doesn't work now, so I'll have to recode.


Thanks,
Dave

---
You are in a maze of testy little Java VMs, all subtly different.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [2.2] Cant get __attribute__ ((__packed__)) to work
      • From: Chris Espinosa <email@hidden>
References: 
 >Re: [2.2] Cant get __attribute__ ((__packed__)) to work (From: Dave Rehring <email@hidden>)
 >Re: [2.2] Cant get __attribute__ ((__packed__)) to work (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Xcode 2.2: /usr/bin/ld: Undefined symbols: __Unwind_Resume
  • Next by Date: Re: Xcode 2.2: /usr/bin/ld: Undefined symbols: __Unwind_Resume
  • Previous by thread: Re: [2.2] Cant get __attribute__ ((__packed__)) to work
  • Next by thread: Re: [2.2] Cant get __attribute__ ((__packed__)) to work
  • Index(es):
    • Date
    • Thread