Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Jason Duerstock <jason@sdi.cluephone.com>
To: axp-list@redhat.com
Cc: Dan Schmitt <dmschmit@rasc-sparc.tamu.edu>
Subject: Re: So Y is my pointer so bogus
Date: Wed, 3 Feb 1999 17:59:15 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.04.9902031756480.6536-100000@sdi.aatech.com> (raw)
In-Reply-To: <36B8CF6A.D373F882@voicenet.com>

Unless my brain has turned to jello lately,

a = (void *) 0;

is the same thing as saying

a = NULL;

and 

a = (int *) a; 

dereferences null, thus causing your program to go kerfloom.

Perhaps you'd like to explain more clearly what you're trying to do?

Jason

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.
> gat
> main()
> {
> 
>         int x1,x2,x3;
>         int y1,y2,y3;
>         unsigned int P;
>         unsigned int S;
>         void *a;
> 
>         a = (void *)0;
>         x1=20,x2=0,x3=0;
>         y1=5, y2=0,y3=0;
>         P = 1;
>         S = 348;
> 
>         a = (int *)a +(x2-x1-x3)*P + (y2-y1-y3)*S;
>         printf("a = %p\n",a);
> }


  reply	other threads:[~1999-02-03 23:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-03 22:36 So Y is my pointer so bogus Uncle George
1999-02-03 22:59 ` Jason Duerstock [this message]
1999-02-03 23:32   ` B. James Phillippe
1999-02-03 23:45     ` Uncle George
1999-02-04  0:51       ` Michal Jaegermann
1999-02-04  0:55         ` Michal Jaegermann
1999-02-03 23:36   ` Uncle George
1999-02-03 23:40   ` Re[2]: " Dan
1999-02-04  0:38 ` Michal Jaegermann
1999-02-04 11:25 ` Phil Carmody
  -- strict thread matches above, loose matches on Subject: below --
1999-02-03 22:57 Lagodzinski, Andrew
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox