Re: size of enum when used with NSCoder decodeValueOfObjCType: ??? int?
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/