• 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: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?


  • Subject: Re: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Tue, 24 Jul 2001 19:37:30 -0400

On Tuesday, July 24, 2001, at 06:51 , tyler wrote:

Hey All,
So anyone know what type to use with the NSCoder protocol for enums...?

In CW there was an "enums always int" preference to force int size for enums, though that caused real problems with the MSL if you were not careful.


Here's where I'm wondering:


typedef enum statusType {
SOME_STATUS_NO = 0,
SOME_STATUS_YES,
SOME_STATUS_MAYBE
} statusType;


- (id)initWithCoder:(NSCoder *) aDecoder
{
[ aDecoder decodeValueOfObjCType: @encode(int) at: &status ]; // int??
}

How about this:

- (id)initWithCoder:(NSCoder*)aDecoder
{
unsigned char temp;
[ aDecoder decodeValueOfObjCType: @encode(unsigned char) at: & temp ];

status = (statusType )temp;
}
--
Clark S. Cox, III
email@hidden
http://www.whereismyhead.com/clark/


  • Follow-Ups:
    • Re: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
      • From: tyler <email@hidden>
References: 
 >size of enum when used with NSCoder decodeValueOfObjCType: ??? int? (From: tyler <email@hidden>)

  • Prev by Date: Objective-C++
  • Next by Date: Re: Objective-C++
  • Previous by thread: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
  • Next by thread: Re: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
  • Index(es):
    • Date
    • Thread