From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: bookkeeping to prepare for a 64-bit EMACS_INT on 32-bit hosts Date: Mon, 02 May 2011 09:09:17 -0700 Organization: UCLA Computer Science Department Message-ID: <4DBED72D.9070207@cs.ucla.edu> References: <4DBA71FB.5090900@cs.ucla.edu> <83mxj97889.fsf@gnu.org> <4DBA7F87.5040609@cs.ucla.edu> <4DBB67E2.1040202@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1304352582 20575 80.91.229.12 (2 May 2011 16:09:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 May 2011 16:09:42 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 02 18:09:36 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QGvgi-0001xD-SG for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 18:09:33 +0200 Original-Received: from localhost ([::1]:52283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGvgi-0004Bj-4o for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 12:09:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:56281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGvge-0004BH-GE for emacs-devel@gnu.org; Mon, 02 May 2011 12:09:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGvgd-0002GR-HQ for emacs-devel@gnu.org; Mon, 02 May 2011 12:09:28 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:55541) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGvgc-0002G7-5I; Mon, 02 May 2011 12:09:26 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 3015D39E80F2; Mon, 2 May 2011 09:09:25 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DsDsJXzCi3wV; Mon, 2 May 2011 09:09:24 -0700 (PDT) Original-Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id A511F39E8100; Mon, 2 May 2011 09:09:24 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138963 Archived-At: On 05/02/11 07:46, Stefan Monnier wrote: >>>>> >>> > - /* The EMACS_INT cast avoids a warning. */ >>>>> >>> > + EMACS_INTPTR ii = i; >>>>> >>> > + gpointer gi = (gpointer) ii; >>> >> Is there a particular reason why you use an intermediate var rather >>> >> than use the more concise "(gpointer) (EMACS_INTPTR) i"? >> > To avoid a cast. > I'm not sure what is the formal definition of "cast" in C, but at least > from my point of view, your code performs just the same kind of coercion > as a cast. The runtime behavior is the same, but avoiding the cast can catch more errors. Suppose "i" is of type "struct tm *", say, and the programmer made a mistake. Then GCC will issue a helpful diagnostic for the form with just one cast, but it won't diagnose the more-concise form with two casts. >> > If you prefer conciseness to avoiding these casts, I can easily change >> > these to the more-concise form. > I do prefer the more concise form, and paradoxically part of the reason > is because it is uses a explicit coercion rather than an implicit one. OK, will do (unless the above argument convinced you :-).