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: Compiling Elisp to a native code with a GCC plugin Date: Fri, 17 Sep 2010 18:39:50 +0200 Message-ID: <83bp7w1fzd.fsf@gnu.org> References: <87bp805ecr.fsf@gmail.com> <87iq26z97e.fsf@uwakimon.sk.tsukuba.ac.jp> <87y6b0yi8o.fsf@uwakimon.sk.tsukuba.ac.jp> <87sk18bioh.fsf@lola.goethe.zz> <87fwx8bhkq.fsf@lola.goethe.zz> <83fwx81gzp.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1284741608 1407 80.91.229.12 (17 Sep 2010 16:40:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 17 Sep 2010 16:40:08 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lars Magne Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 17 18:40:06 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 1Owdym-0008RF-L7 for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 18:40:04 +0200 Original-Received: from localhost ([127.0.0.1]:35162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Owdyl-00019l-TP for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 12:40:03 -0400 Original-Received: from [140.186.70.92] (port=36018 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Owdyc-00018q-Ae for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:39:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwdyY-00059Y-IF for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:39:54 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:39494) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwdyY-00059I-Aq for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:39:50 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0L8W00L00GSCX300@a-mtaout21.012.net.il> for emacs-devel@gnu.org; Fri, 17 Sep 2010 18:39:48 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.210.149]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L8W00LEIGY9RDA0@a-mtaout21.012.net.il>; Fri, 17 Sep 2010 18:39:48 +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:130341 Archived-At: > From: Lars Magne Ingebrigtsen > Date: Fri, 17 Sep 2010 18:24:34 +0200 > > The thing I'm must unclear on now is whether it's valid to say > > int thing = PT; > > and whether it's valid to say > > PT + 1; PT is just a number, an integral data type. So adding one to it is okay. But storing into an `int' is not, because PT is an EMACS_INT, see `struct buffer': struct buffer { ... /* Char position of point in buffer. */ EMACS_INT pt; /* Byte position of point in buffer. */ EMACS_INT pt_byte; EMACS_INT is a 64-bit data type on 64-bit machines, so assigning it to an int is a bug waiting to happen. You should do this instead: EMACS_INT thing = PT; > I've grepped through the code, and this seems to be used all over the > place Each place where you see PT assigned to an int is a bug, please either report it or fix it right away. > so I'm guessing that perhaps the size of a buffer is constrained > to be less than INT_MAX? No, it's constrained by most-positive-fixnum (MOST_POSITIVE_FIXNUM in C), but we still have many places where we use a int, which is why buffers larger than MAX_INT not always work well.