From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Preventing warnings in FIXNUM_OVERFLOW_P Date: Thu, 18 Jan 2007 14:39:05 -0500 Message-ID: References: <85lkk0npzj.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169149184 32410 80.91.229.12 (18 Jan 2007 19:39:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 18 Jan 2007 19:39:44 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 18 20:39:39 2007 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.50) id 1H7d6j-0001Sr-IB for ged-emacs-devel@m.gmane.org; Thu, 18 Jan 2007 20:39:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7d6k-0001GM-A0 for ged-emacs-devel@m.gmane.org; Thu, 18 Jan 2007 14:39:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H7d6Y-0001Ev-LC for emacs-devel@gnu.org; Thu, 18 Jan 2007 14:39:22 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H7d6U-0001Dn-Hy for emacs-devel@gnu.org; Thu, 18 Jan 2007 14:39:22 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H7d6U-0001DZ-Dv for emacs-devel@gnu.org; Thu, 18 Jan 2007 14:39:18 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1H7d6P-0006s0-29; Thu, 18 Jan 2007 14:39:14 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id CB7FF2CF199; Thu, 18 Jan 2007 14:39:12 -0500 (EST) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id B57F93FE1; Thu, 18 Jan 2007 14:39:05 -0500 (EST) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A2BA84C6D25; Thu, 18 Jan 2007 14:39:05 -0500 (EST) Original-To: David Kastrup In-Reply-To: <85lkk0npzj.fsf@lola.goethe.zz> (David Kastrup's message of "Thu\, 18 Jan 2007 19\:34\:24 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca 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:65283 Archived-At: >> You can avoid it by using unsigned types. I think that something like >> this will do the trick: >> >> #define FIXNUM_OVERFLOW_P(i) \ >> ((unsigned long long)(i) > MOST_POSITIVE_FIXNUM \ >> && (unsigned long long)(i) < MOST_NEGATIVE_FIXNUM) >> >> Would someone please give that approach a try and see if it works? I >> am having too much trouble with concentration right now to see whether >> that code is correct -- it might need somewhat more change than that >> in order to get the comparisons right in an unsigned type. > unsigned long long is neither guaranteed to exist on all supported > architectures, nor guaranteed to be longer than long. > It seems to me like something along the lines of > #define FIXNUM_OVERFLOW_P(i) \ > (((unsigned long)(i)-(unsigned long)MOST_NEGATIVE_FIXNUM) > \ > (unsigned long)MOST_POSITIVE_FIXNUM) That might be OK if we're trying to obfuscate the code. Eli's current workaround is still the least bad I've seen. Stefan