From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12265 invoked by alias); 5 Oct 2008 09:54:52 -0000 Received: (qmail 12254 invoked by uid 22791); 5 Oct 2008 09:54:51 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 05 Oct 2008 09:54:13 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id m959s8bc029386; Sun, 5 Oct 2008 11:54:09 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id m959s7GA011717; Sun, 5 Oct 2008 11:54:07 +0200 (CEST) Date: Sun, 05 Oct 2008 09:54:00 -0000 Message-Id: <200810050954.m959s7GA011717@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: schwab@suse.de CC: msnyder@vmware.com, gdb-patches@sourceware.org, teawater@gmail.com In-reply-to: (message from Andreas Schwab on Sun, 05 Oct 2008 09:11:27 +0200) Subject: Re: [RFA record/replay] cast to avoid compiler warning References: <48E7B927.9050207@vmware.com> <200810042152.m94LqN1R018675@brahms.sibelius.xs4all.nl> 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/msg00125.txt.bz2 > From: Andreas Schwab > Date: Sun, 05 Oct 2008 09:11:27 +0200 > > Mark Kettenis writes: > > >> 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. > > The value will always be a small number. It is still a bad example. People may copy the idiom and uses it on cases where the value is not a small number. Why rely on the fact that it always will be a small number if you can fix it properly?