From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9172 invoked by alias); 1 Jul 2005 08:45:26 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 9133 invoked by uid 22791); 1 Jul 2005 08:45:21 -0000 Received: from web26907.mail.ukl.yahoo.com (HELO web26907.mail.ukl.yahoo.com) (217.146.176.96) by sourceware.org (qpsmtpd/0.30-dev) with SMTP; Fri, 01 Jul 2005 08:45:21 +0000 Received: (qmail 9201 invoked by uid 60001); 1 Jul 2005 08:45:19 -0000 Message-ID: <20050701084519.9199.qmail@web26907.mail.ukl.yahoo.com> Received: from [62.253.198.200] by web26907.mail.ukl.yahoo.com via HTTP; Fri, 01 Jul 2005 10:45:19 CEST Date: Fri, 01 Jul 2005 08:45:00 -0000 From: Etienne Lorrain Subject: sizeof() function parameter array: known problem? To: gcc@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SW-Source: 2005-07/txt/msg00024.txt.bz2 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