--- Dorin Lazar <[EMAIL PROTECTED]> wrote:

> On Friday 15 October 2004 22:25, dbs2 wrote:
> > numar.c: In function `main':
> > numar.c:10: warning: integer constant is too large for "long" type
> > numar.c:11: warning: unknown conversion type character 0xa in format
> > numar.c:11: warning: too many arguments for format
> > numar.c:13:2: warning: no newline at end of file
>   Dupa cum vezi, programul ti se compileaza (ai numai warning-uri).
>   %q ar trebui inlocuit cu %lld.
>   cat despre numar=5000000000; gcc-2.96 si gcc-3.2.3 nu mi s-au plans sub nici 
> o forma.
>   Dorin
> PS: Transcript:
> [EMAIL PROTECTED] spooky]$ vi test.c
> [EMAIL PROTECTED] spooky]$ make test
> cc     test.c   -o test
> [EMAIL PROTECTED] spooky]$ ./test
> %
> [EMAIL PROTECTED] spooky]$ make test
> cc     test.c   -o test
> [EMAIL PROTECTED] spooky]$ ./test
> 5000000000
> [EMAIL PROTECTED] spooky]$ export CFLAGS="-Wall"
> [EMAIL PROTECTED] spooky]$ rm test
> [EMAIL PROTECTED] spooky]$ make test
> cc -Wall    test.c   -o test
> [EMAIL PROTECTED] spooky]$ rm test
> [EMAIL PROTECTED] spooky]$ export CC=gcc-3.2.3
> [EMAIL PROTECTED] spooky]$ make test
> gcc-3.2.3 -Wall    test.c   -o test
> [EMAIL PROTECTED] spooky]$ cc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
> [EMAIL PROTECTED] spooky]$ gcc-3.2.3 -v
> Reading specs from /opt/gcc/lib/gcc-lib/i686-linux/3.2.3/specs
> Configured with: ./configure --prefix=/opt/gcc --program-suffix=-3.2.3 
> --with-local-prefix=/opt/gcc --enable-shared --enable-languages=c,c++ 
> --disable-nls --target=i686-linux
> Thread model: posix
> gcc version 3.2.3
> [EMAIL PROTECTED] spooky]$
> 
> --- 
> Detalii despre listele noastre de mail: http://www.lug.ro/
> 
> 
> 

Am rezolvat partial 


Am inlocuit %q cu %lld in printf:

$cat a.c

#include <stdio.h>
#include <stdlib.h>
 
                      
long long int numar;
int
main (int argc, char **argv)
{
numar=500000000000;
printf("%lld\n",numar);
return 0;
}

L-am compilat :

$gcc -Wall a.c
a.c: In function `main':
a.c:10: warning: integer constant is too large for "long" type

La executie afiseaza ce trebuie :

$./a.out
500000000000


Dar ramane avertismentul din linia 10 
a.c:10: warning: integer constant is too large for "long" type

Imlicit orice constanta intreaga o considera long int ?

Linuxul este un  Fedora Core 1.

Versiunea de gcc este 3.3.2

 $gcc --ver
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man 
--infodir=/usr/share/info
--enable-shared --enable-threads=posix --disable-checking --with-system-zlib 
--enable-__cxa_atexit
--host=i386-redhat-linux
Thread model: posix
gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)

Am mai adaugat in linia 

numar=500000000000;

un LL (long long) in capat, langa constanta

numar=500000000000LL;

$gcc -Wall a.c
$./a.out
500000000000

Acum merge :)


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui