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: bookkeeping to prepare for a 64-bit EMACS_INT on 32-bit hosts Date: Sat, 30 Apr 2011 10:30:11 +0300 Message-ID: <83tydg5h8c.fsf@gnu.org> References: <4DBA71FB.5090900@cs.ucla.edu> <83mxj97889.fsf@gnu.org> <4DBA7F87.5040609@cs.ucla.edu> <4DBBB23A.6050702@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1304148639 11349 80.91.229.12 (30 Apr 2011 07:30:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 30 Apr 2011 07:30:39 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 30 09:30:34 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 1QG4dM-0004xt-A2 for ged-emacs-devel@m.gmane.org; Sat, 30 Apr 2011 09:30:32 +0200 Original-Received: from localhost ([::1]:33943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG4dL-0004xf-RN for ged-emacs-devel@m.gmane.org; Sat, 30 Apr 2011 03:30:31 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:45985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG4dJ-0004xZ-K2 for emacs-devel@gnu.org; Sat, 30 Apr 2011 03:30:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QG4dI-00052O-7r for emacs-devel@gnu.org; Sat, 30 Apr 2011 03:30:29 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:63570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QG4dI-00052K-1H for emacs-devel@gnu.org; Sat, 30 Apr 2011 03:30:28 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LKG00G00FI53900@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Sat, 30 Apr 2011 10:30:11 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.124.150.132]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LKG00FP2FI9WE50@a-mtaout20.012.net.il>; Sat, 30 Apr 2011 10:30:11 +0300 (IDT) In-reply-to: <4DBBB23A.6050702@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 80.179.55.166 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:138923 Archived-At: > Date: Fri, 29 Apr 2011 23:54:50 -0700 > From: Paul Eggert > CC: emacs-devel@gnu.org > > On 04/29/11 02:06, Paul Eggert wrote: > > I will look into extending that patch, so that it also works with > > __int64. > > Here's one way to do that. Add this to nt/config.nt, > after the BITS_PER_LONG definition: > > #if (defined __MINGW32__ \ > || 1400 <= _MSC_VER || (1310 <= _MSC_VER && defined _MSC_EXTENSIONS)) > /* C99-style long long and "%lld" both work, so use them. */ > # define BITS_PER_LONG_LONG 64 > #elif 1200 <= _MSC_VER > /* Use pre-C99-style 64-bit integers. */ > # define EMACS_INT __int64 > # define BITS_PER_EMACS_INT 64 > # define pI "I64" > #endif Thanks! > I inferred the above by looking at random stuff > off the net, and haven't actually tested it; quite possibly > it's not exactly right for Emacs but something like this should work. I think it is correct, except for one minor gotcha: _MSC_EXTENSIONS do NOT enable a `long long' data type in versions of MSVC before 1400. _MSC_EXTENSIONS enable the use of __int64 in all versions of the MS compiler. Also, _MSC_EXTENSIONS is on by default, so there's no need to test for it explicitly. According to my reading of the MS documentation, the `long long' data type is supported by MSVC only starting from version 1400; before that, we should use __int64. So I would change the above to say #if (defined __MINGW32__ || 1400 <= _MSC_VER) /* C99-style long long and "%lld" both work, so use them. */ # define BITS_PER_LONG_LONG 64 #elif 1200 <= _MSC_VER /* Use pre-C99-style 64-bit integers. */ # define EMACS_INT __int64 # define BITS_PER_EMACS_INT 64 # define pI "I64" #endif > Also, I plan to simplify the rats-nest of EMACS_INT ifdefs in lisp.h > to the following. This should make this stuff easier to follow. That'd be fine, thanks.