• 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: Specifying "enum" data size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specifying "enum" data size


  • Subject: Re: Specifying "enum" data size
  • From: Chris Espinosa <email@hidden>
  • Date: Fri, 23 Sep 2005 17:17:02 -0700

On Sep 23, 2005, at 5:04 PM, Mark Wagner wrote:

How do I specify the size of an "enum" value?  I've got a program that

links to a number of static libraries.  In one of them, an "enum" for

the typedef'd "BoolEnum" type is one bit, while in another, it's 32

bits.  Needless to say, this causes problems when passing structs

containing BoolEnums back and forth.


Does GCC recognize the "#pragma enumsalwaysint" pragma?  Might the

presence of this in some of the source files be causing problems?


I'm using XCode 1.5 and GCC 3.3, and I'm writing in C.


The only control available is -fshort-enums ("Short Enumeration Constants") which you can apply on a target or on a single file.  There's no pragma to make this apply only to specific enums within a file.  This will make enums as small as possible for the range of enums given.

Notice that Mac OS X frameworks often declare structs that contain enumerated values, so changing the size of enums might make your code unable to call Mac OS X system functions.

Chris
 _______________________________________________
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: Specifying "enum" data size
      • From: Andreas Grosam <email@hidden>
References: 
 >Specifying "enum" data size (From: Mark Wagner <email@hidden>)

  • Prev by Date: Specifying "enum" data size
  • Next by Date: Re: in-class initialization of fundamental types
  • Previous by thread: Specifying "enum" data size
  • Next by thread: Re: Specifying "enum" data size
  • Index(es):
    • Date
    • Thread