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:56 +0200 Message-ID: <83aang1fz7.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 1284741705 1822 80.91.229.12 (17 Sep 2010 16:41:45 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 17 Sep 2010 16:41:45 +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:41:43 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 1Owe0F-0001Aj-D3 for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 18:41:42 +0200 Original-Received: from localhost ([127.0.0.1]:36321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Owe09-0001qh-77 for ged-emacs-devel@m.gmane.org; Fri, 17 Sep 2010 12:41:29 -0400 Original-Received: from [140.186.70.92] (port=36043 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Owdym-0001D7-Jj for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:40:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Owdyj-0005As-5j for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:40:04 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:52733) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Owdyi-0005Al-UI for emacs-devel@gnu.org; Fri, 17 Sep 2010 12:40:01 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0L8W00300GQ99300@a-mtaout20.012.net.il> for emacs-devel@gnu.org; Fri, 17 Sep 2010 18:39:59 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.210.149]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0L8W003C9GYE1650@a-mtaout20.012.net.il>; Fri, 17 Sep 2010 18:39:52 +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:130342 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.