gnu.gcc.help
[Top] [All Lists]

What have I done wrong?

Subject: What have I done wrong?
From: Pilcrow <pilcrow@xxxxxxx>
Date: Tue, 22 Jul 2008 12:15:00 -0700
Newsgroups: gnu.gcc.help

I have a fair understanding of perl, now I'm trying to learn C.
I'm trying to use long long, with trouble.  Here is demo code.
I'm using the gcc that came with strawberry perl.
Same output if I say %lld instead of %lli.  
Grateful for any help I can get.

// demo.c
#include <stdio.h>
#include <limits.h>
int main()
{
        printf("%d\n",sizeof(long long));
        printf("%llu \n",ULLONG_MAX);
        printf("%lli \n",LLONG_MIN);
        printf("%lli \n",LLONG_MAX);
        printf("%lli to %lli \n",LLONG_MIN,LLONG_MAX);
}

Here is the output.

C:\>gcc --version
gcc (GCC) 3.4.5 (mingw special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.


C:\>gcc -std=c99, -Wall demo.c

C:\>a
8
4294967295
0
-1
0 to -2147483648

C:\>


<Prev in Thread] Current Thread [Next in Thread>