Chip Salzenberg on 26 Apr 2004 21:24:02 -0000


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

[PLUG] Re: #define for 32 vs 64 bit C program?


According to Walt Mankowski:
> int main () {
>         long i = 42;
> #if __WORDSIZE == 64
>         printf("i = %ld\n", i);
> #else
>         printf("i = %d\n", i);
> #endif
>         return 0;
> }

But but but!  "%ld" is always right for long, no matter what.
-- 
Chip Salzenberg               - a.k.a. -               <chip@pobox.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
    but he stepped in a wormhole and had to go in early."  // MST3K
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug