Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Christopher Curtis <ccurtis@ee.fit.edu>
To: axp-list@redhat.com
Subject: Re: Making programs 64 bit clean
Date: Mon, 22 Jun 1998 15:27:27 -0400 (EDT)	[thread overview]
Message-ID: <Pine.GSO.3.96.980622152418.18382B-100000@yacht.ee.fit.edu> (raw)
In-Reply-To: <Pine.LNX.3.96.980622112328.5028A-100000@rnaworld.princeton.edu>

On Mon, 22 Jun 1998, Tim Jenkins wrote:

> long foo;
> int *bar;
> 
> foo = (long) bar;
> 
> 
> Is this an acceptable solution to making programs 64 bit clean and is it
> portable across 32 bit and 64 bit platforms? 

Basically, no.  If you need a pointer, use a pointer.  If you need an
int/long use an int/long.  The only really portable way to do this is to
union them and use it as such.  The only time it's really "safe" to use
casts that change types (eg, excluding signed/unsigned) is when you have a
variable argument list or void pointers.  The bummer is that function
pointers can't be converted into void pointers portably.  :(

regards,
--
Christopher Curtis               - http://www.ee.fit.edu/users/ccurtis
Florida Institute of Technology  - System Administrator, Programmer
Melbourne, Florida  USA          - http://www.lp.org/


  parent reply	other threads:[~1998-06-22 19:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-22 15:36 Making programs 64 bit clean Tim Jenkins
1998-06-22 18:09 ` Paul Tomblin
1998-06-22 19:27 ` Christopher Curtis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-06-22 17:35 Greg Lindahl
1998-06-22 19:32 ` Michal Jaegermann
1998-06-22 20:47   ` Christopher Curtis
1998-06-22 21:49     ` Michal Jaegermann
1998-06-22 21:50     ` Paul Tomblin
1998-06-22 22:24       ` Jeff Sturm
1998-06-22 19:53 ` Richard Hadsell
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