From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 32620 invoked from network); 22 Jun 1998 19:28:55 -0000 Received: from winnie.fit.edu (163.118.5.1) by mail2.redhat.com with SMTP; 22 Jun 1998 19:28:55 -0000 Received: from ee.fit.edu (yacht.ee.fit.edu [163.118.30.1]) by winnie.fit.edu (8.8.7/8.8.7) with SMTP id PAA27315 for ; Mon, 22 Jun 1998 15:24:08 -0400 (EDT) Received: from localhost by ee.fit.edu (SMI-8.6/SMI-SVR4) id PAA18639; Mon, 22 Jun 1998 15:27:30 -0400 Date: Mon, 22 Jun 1998 15:27:27 -0400 (EDT) From: Christopher Curtis To: axp-list@redhat.com Subject: Re: Making programs 64 bit clean In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/