From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Mr. Peter Ivanyi" Newsgroups: gmane.lisp.guile.devel Subject: Re: SCM_PTR_LE ? Date: Thu, 01 Aug 2002 18:09:59 +0100 Sender: guile-devel-admin@gnu.org Message-ID: <3D496B67.D902AD62@carme.sect.mce.hw.ac.uk> References: <15682.60268.422843.138038@blauw.xs4all.nl> <15687.4663.59228.939494@blauw.xs4all.nl> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1028221842 17394 127.0.0.1 (1 Aug 2002 17:10:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 1 Aug 2002 17:10:42 +0000 (UTC) Cc: "guile-devel@gnu.org" Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17aJTD-0004WH-00 for ; Thu, 01 Aug 2002 19:10:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17aJTb-0003oL-00; Thu, 01 Aug 2002 13:11:03 -0400 Original-Received: from carme.sect.mce.hw.ac.uk ([137.195.68.1]) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17aJTH-0003nb-00 for ; Thu, 01 Aug 2002 13:10:43 -0400 Original-Received: from carme.sect.mce.hw.ac.uk (mercury.sect.mce.hw.ac.uk [137.195.68.189]) by carme.sect.mce.hw.ac.uk (8.9.3/8.9.3/Debian/GNU) with ESMTP id SAA16584; Thu, 1 Aug 2002 18:10:30 +0100 X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.15-3SGI_39 i686) X-Accept-Language: en Original-To: Marius Vollmer Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:918 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:918 Marius Vollmer wrote: > What is that definition? I think ANSI C only defines the outcome of > comparisons for pointers that point into the same object, i.e., the > same array or a single block returned from malloc. A consequence > would be that you can not reliably test whether a pointer does point > into some object, since the results are not defined when it points > outside. For example, is the following guaranteed to print "sane"? > > char block1[100]; > char block2[100]; > > char *ptr = block1 + 50; > > if (ptr >= block2 && ptr < block2+100) > printf ("sane\n"); > else > printf ("insane\n"); > > I don't know. Well, some of the memory checker programs would definitely signal an error for the above code. As I remember, ANSI defines, that if a pointer goes out of its range, then it becomes undefined. This have the unfortunate consequence that block2+2000-1990 is not valid, you have to calculate the offset first, than use it with the pointer. On the positive side though, I have never seen, heard any compiler which takes this as a problem, only memory checker. Hope it helps a little bit. Peter Ivanyi _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel