GCC a velka cisla
Tomas Konir
moje na vabo.cz
Čtvrtek Listopad 27 13:39:22 CET 2003
On Thu, 27 Nov 2003, Pavel Janoušek wrote:
> Zdravim po ranu,
>
> damy a panove, je schopen toto nekdo vyzkouset na GCC novejsi nez
> 3.0.4 v modu C99 a podelit se o vysledek?
>
[moje na moje work]$ gcc -c test.c
test.c: In function `main':
test.c:10: warning: integer constant is too large for "long" type
test.c:12: warning: integer constant is too large for "long" type
test.c:13: warning: integer constant is too large for "long" type
[moje na moje work]$ gcc -std=c99 -c test.c
[moje na moje work]$ gcc -o test test.o
[moje na moje work]$ ./test
1000000000
5294967296
[moje na moje TrafficWatch-libpcap]$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
moje 23348 0.0 0.0 978020 316 pts/12 S 13:35 0:00 ./test
[moje na moje work]$ gcc -v
gcc version 3.3.1
Staci to takhle ?
MOJE
P.S. sice je to long long, ale pro malloc se to zjevne orizne, protoze
bohuzel nemam 64bit system.
> #include <stdlib.h>
> #include <stdio.h>
> #include <errno.h>
>
> #define SIZE 5294967296L
>
> int main (void)
> {
>
> char *p = malloc ((size_t) SIZE);
>
> printf("%li\n", (long int) SIZE);
> printf("%lli\n", (long long) SIZE);
> if (p == NULL)
> {
> perror ("malloc");
> return (0);
> }
>
> getchar ();
>
> free (p);
>
> return (0);
> }
>
--
Konir Tomas
Czech Republic
Brno
ICQ 25849167
Další informace o konferenci Linux