sizeof() function parameter array: known problem?
Etienne Lorrain
etienne_lorrain@yahoo.fr
Fri Jul 1 08:45:00 GMT 2005
The result of this funtion is 1, is there a C lawyer around?
$ cat tmp.c
unsigned fct (unsigned array[10])
{
return sizeof(array) / sizeof(array[0]);
}
$ gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.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
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
$ gcc -S -o tmp.s tmp.c
$ cat tmp.s
.file "tmp.c"
.text
.globl fct
.type fct, @function
fct:
pushl %ebp
movl %esp, %ebp
movl $1, %eax
leave
ret
.size fct, .-fct
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)"
$
Etienne.
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
More information about the Gcc
mailing list