Re: typedef enums are now unsigned?!
Re: typedef enums are now unsigned?!
- Subject: Re: typedef enums are now unsigned?!
- From: Jason Stephenson <email@hidden>
- Date: Sun, 08 Mar 2009 14:08:12 -0400
Ever wish you had an "unsend" button?
using %qi in the printf shows the behavior mentioned by the OP. The
question, though is what is the type of TestEnum?
According to a modified version of the program, it is only 4 bytes wide,
so printing it as a 64 bit int, will give the behavior seen. I think the
question may really be a type mismatch between the enum and the variable
to which it is being assigned.
Anyway, I'll butt out now, since I'm just chattering.
Jason
P.S.
#include <stdio.h>
typedef enum {
Missing = 0,
Present = 1
} TestEnum;
int main (int argc, char **argv)
{
TestEnum bob;
bob = Missing;
printf("%qi\n", bob);
bob = -1;
printf("%qi\n", bob);
printf("%qi\n", sizeof(TestEnum));
return 0;
}
_______________________________________________
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