[cfe-dev] Unexpected results from _Bool cast

Dave Keck davekeck at gmail.com
Sun Dec 5 01:04:36 PST 2010


Hey list,

The following program outputs '0' when compiled on my system with `clang a.c`:

    #include <stdio.h>
    int main(int argc, const char *argv[])
    {
        printf("%d\n", (_Bool)((void *)0xCAFEBABE));
        return 0;
    }

Could someone confirm this is a bug? (Section 6.3.1.2 of C99 seems to
suggest that it is.) I suspect I need to upgrade Xcode/clang/llvm, but
I thought I'd check before I attempt to download that monstrosity on
my wee connection.

Thanks,

David



More information about the cfe-dev mailing list