From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 5103 invoked from network); 3 Feb 1999 23:39:41 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 3 Feb 1999 23:39:41 -0000 Received: from earth.terran.org (bryan@earth.terran.org [208.152.24.33]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id SAA14085 for ; Wed, 3 Feb 1999 18:32:25 -0500 Received: from localhost (bryan@localhost) by earth.terran.org (8.8.7/8.8.9) with ESMTP id PAA19506 for ; Wed, 3 Feb 1999 15:32:23 -0800 Date: Wed, 3 Feb 1999 15:32:23 -0800 (PST) From: "B. James Phillippe" To: axp-list@redhat.com Subject: Re: So Y is my pointer so bogus In-Reply-To: Message-ID: Organization: terran.org/darkforest.org X-Subliminal-Message: Use Linux MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Wed, 3 Feb 1999, Jason Duerstock wrote: > a = (int *) a; > > dereferences null, thus causing your program to go kerfloom. a = (int *) a; just means to tell the compiler to start _treating_ a as a pointer-to-int for that expression in case you wish to do ptr arith on it or deref it. But he doesn't ever dereference it. So: a = (int *)a + 1; will increment a's address by sizeof(int) * 1, which is 4 for Intel, Alpha, etc. > On Wed, 3 Feb 1999, Uncle George wrote: > > > This little example caused a (un-expected ) pointer failure in one of > > the font routines in my java 1.2 port on linux/alpha. It was expected to > > add a -1760 ( -1760 * sizeof(int)) but does not. > > Ugg. what is a 64bitter to do. I *think* I know what you're having problems with; I tried your sample code and some other math and when I do a %p on just plain (int*) 0 - 1760; I got a value of 0xffffffffffffe480 (which is expected), but your sample code instead gave 0x7ffffe480. Seems the 64bit range didn't get assigned in the version of your code. Is this what you were asking about? -bp -- B. James Phillippe . bryan@terran.org Linux Engineer/Admin . http://www.terran.org/~bryan Member since 1.1.59 . finger:bryan@earth.terran.org