From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13699 invoked by alias); 5 May 2010 12:52:08 -0000 Received: (qmail 13477 invoked by uid 48); 5 May 2010 12:51:41 -0000 Date: Wed, 05 May 2010 12:52:00 -0000 Subject: [Bug c/43991] New: typeof (size_t) inconsistency X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jimsmite at rocketmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg00420.txt.bz2 size_t is declared as unsigned int on 32-bit and unsigned long on 64-bit. As a result, following code will emit a warning on amd-64: printf ("%u\n", sizeof (int)); test.c:5: warning: format ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ but changing the format would then fail on ia-32: printf ("%lu\n", sizeof (int)); test.c:5: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘unsigned int’ there seems to be no way to satisfy this other than a cast, which seems a bit awkward. Is there any reason for size_t not being "unsigned long" consistently on all platforms? -- Summary: typeof (size_t) inconsistency Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jimsmite at rocketmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43991