This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
sizeof() function parameter array: known problem?
- From: Etienne Lorrain <etienne_lorrain at yahoo dot fr>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 1 Jul 2005 10:45:19 +0200 (CEST)
- Subject: sizeof() function parameter array: known problem?
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