> > "Arnaud Bergeron" <[EMAIL PROTECTED]> writes: > > > >> mt-daapd suffers from a case I've named 0.5: > >> > >> pointer -> int > >> > >> and then the int is used as a truth value. So this is not a bug. > > > > Not a bug? Really? > > > > $ cat foo.c > > int > > main() > > { > > int true; > > void *nonnull = (void *)0x7000000000000000; > > > > true = nonnull; > > printf(true ? "true\n" : "false\n"); > > true = !!nonnull; > > printf(true ? "true\n" : "false\n"); > > } > > $ make foo > > cc -O2 -pipe -o foo foo.c > > foo.c: In function `main': > > foo.c:7: warning: assignment makes integer from pointer without a cast > > $ ./foo > > false > > true > > $ > > > > //art > > I'll admit I didn't think about this. So I'll have to fix it. It > helps that most uses of the pointers look like that:
And think about the big-endian 64 bit machines too. If the cast is in the right place, and you ensure that all memory is allocated below 4GB... guess what happens.