Q: about "long long" type..

Q: about "long long" type..

Post by Andrew Gier » Sun, 21 Jan 1996 04:00:00

Quote:> I'm trying to use "long long" type.

>int main(int argc, char *argv[])
>        long long xx = 9000000000000000000;
>/*      long long xx = 9000,000,000,000,000,000; */

>        printf( "%Ld\n", (unsigned long long) xx );

>When I compile this with gcc v2.7.0, I see warnings.

>filename.c: In function `main':
>filename.c:3: warning: integer constant out of range
>filename.c:3: warning: decimal constant is so large that it is unsigned

>I don't hope to see any warnings.  But I think it's not good to ignore all
>warning.   How can I fix this warning?

Integer constants require a suffix to indicate the type.


        1234            is type int
        12345678L       is type long
        1234U           is type unsigned
        12345678UL      is type unsigned long
        123456780000LL  is type long long
        123456780000ULL is type unsigned long long

Correct use of these will eliminate the warning messages.

[.sig under construction]


Q: about "long long" type..

Post by Stephen Bayn » Wed, 24 Jan 1996 04:00:00

:  I'm trying to use "long long" type.

:         printf( "%Ld\n", (unsigned long long) xx );

Nothing to do with your original question - but I think this line should be
corrected to one of:
         printf( "%Lu\n", (unsigned long long) xx );
         printf( "%Ld\n", (long long) xx );


Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom