From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7756 invoked by alias); 5 Oct 2008 12:17:38 -0000 Received: (qmail 7746 invoked by uid 22791); 5 Oct 2008 12:17:37 -0000 X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (80.101.103.228) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 05 Oct 2008 12:16:43 +0000 Received: from dijkstra.wildebeest.org ([192.168.1.29]) by gnu.wildebeest.org with esmtp (Exim 4.63) (envelope-from ) id 1KmSXL-0002JI-0e; Sun, 05 Oct 2008 14:16:35 +0200 Subject: Re: [RFA record/replay] cast to avoid compiler warning From: Mark Wielaard To: Mark Kettenis Cc: msnyder@vmware.com, gdb-patches@sourceware.org, teawater@gmail.com In-Reply-To: <200810042152.m94LqN1R018675@brahms.sibelius.xs4all.nl> References: <48E7B927.9050207@vmware.com> <200810042152.m94LqN1R018675@brahms.sibelius.xs4all.nl> Content-Type: text/plain Date: Sun, 05 Oct 2008 12:17:00 -0000 Message-Id: <1223208994.3267.31.camel@dijkstra.wildebeest.org> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit X-Spam-Score: -2.2 (--) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-10/txt/msg00127.txt.bz2 On Sat, 2008-10-04 at 23:52 +0200, Mark Kettenis wrote: > > Date: Sat, 04 Oct 2008 11:42:47 -0700 > > From: Michael Snyder > > > > Sizeof returns size_t, which is not always the same as int. > > This cast will prevent compiler warnings on some architectures > > (eg. x86_64) > > This is wrong! Better cast to unsigned long and print as %lu. > > There is a C99 way to do this, but not all systems implement it properly. gnulib provides a posix compatible printf that understands %z for size_t: http://www.gnu.org/software/gnulib/manual/html_node/printf.html Cheers, Mark