qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OT: C Q/As, was Re: [Qemu-devel] security_20040618


From: Christof Petig
Subject: OT: C Q/As, was Re: [Qemu-devel] security_20040618
Date: Mon, 21 Jun 2004 10:50:44 +0200
User-agent: Mozilla/5.0 (X11; U; Linux ppc; de-AT; rv:1.6) Gecko/20040414 Debian/1.6-5

Charlie Gordon schrieb:
Charlie the C teaser.
---------------------
one of my favorite Q/As : what is wrong with : enum BOOL { FALSE=0,
TRUE=1 }; ?

can you enlighten me? The only drawback I see is that with plain C (no C++) typedef enum { ... } BOOL; would be more appropriate.

I would propose
#ifndef __cplusplus
typedef enum { false, true } bool;
#endif
as the optimal solution for a problem I hardly have (since I usually don't go back to coding in C)

   Christof

PS: I used to ask: Why does this crash later (if you are lucky)

const char *itoa(int i)
{  char x[20];
   snprintf(x,sizeof x,"%d",i);
   return x;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]