Re: typedef enums are now unsigned?!
Re: typedef enums are now unsigned?!
- Subject: Re: typedef enums are now unsigned?!
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sun, 8 Mar 2009 19:04:11 +0100
Le 8 mars 09 à 18:57, Jason Stephenson a écrit :
However, this program shows that what I just said may be inaccurate:
#include <stdio.h>
typedef enum {
Missing = 0,
Present = 1
} TestEnum;
int main (int argc, char **argv)
{
TestEnum bob;
bob = Missing;
printf("%i\n", bob);
bob = -1;
printf("%i\n", bob);
return 0;
}
When built with -arch x86_64, it prints 0, -1. Ditto when built for
i386.
The output is defined by the printf format, not by the actual value.
unsigned int i = -1
will also output -1 if you use %i.
_______________________________________________
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