From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Emacs-diffs Digest, Vol 94, Issue 89 Date: Sat, 25 Sep 2010 09:31:38 +0200 Message-ID: <83iq1us2hx.fsf@gnu.org> References: <83zkv7rmpe.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1285399913 31612 80.91.229.12 (25 Sep 2010 07:31:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 25 Sep 2010 07:31:53 +0000 (UTC) Cc: larsi@gnus.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 25 09:31:52 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OzPEd-0001pb-8R for ged-emacs-devel@m.gmane.org; Sat, 25 Sep 2010 09:31:51 +0200 Original-Received: from localhost ([127.0.0.1]:56025 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzPEc-00053E-Jz for ged-emacs-devel@m.gmane.org; Sat, 25 Sep 2010 03:31:50 -0400 Original-Received: from [140.186.70.92] (port=45129 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzPES-000539-5n for emacs-devel@gnu.org; Sat, 25 Sep 2010 03:31:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OzPEN-0001Ub-6H for emacs-devel@gnu.org; Sat, 25 Sep 2010 03:31:40 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:41674) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzPEM-0001UU-Uj for emacs-devel@gnu.org; Sat, 25 Sep 2010 03:31:35 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0L9A00900KUD4800@a-mtaout23.012.net.il> for emacs-devel@gnu.org; Sat, 25 Sep 2010 09:31:33 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.127.203.3]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L9A009RZKWK0C70@a-mtaout23.012.net.il>; Sat, 25 Sep 2010 09:31:33 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130830 Archived-At: > X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 > autolearn=unavailable version=3.3.1 > From: Stefan Monnier > Date: Sat, 25 Sep 2010 00:25:10 +0200 > Cc: Lars Magne Ingebrigtsen , emacs-devel@gnu.org > > >> - int frame_lines = FRAME_LINES (frame); > >> + EMACS_INT frame_lines = FRAME_LINES (frame); > > > Is this really a good idea? There's no chance the number of lines in > > a frame will overflow a 32-bit int any time soon. SO I think an > > explicit cast to int is a better solution here. > > BTW, if you add casts, as much as possible add them only inside macros, So what is the practical guidance to Lars and others who go by the warnings emitted by -Wconversion? Will the below be okay, for when an small-valued EMACS_INT is assigned to an int: . if the source is EMACS_INT, consider making it an int; if that's not possible, cast to int, preferably inside a macro . if the source is a Lisp_Object passed through XINT, cast to an int, preferably inside an accessor macro