From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 26718 invoked from network); 22 Jun 1998 17:36:11 -0000 Received: from mail.virginia.edu (128.143.2.9) by mail2.redhat.com with SMTP; 22 Jun 1998 17:36:11 -0000 Received: from ares.cs.virginia.edu by mail.virginia.edu id aa28639; 22 Jun 98 13:35 EDT Received: from adder.cs.Virginia.EDU (adder.cs.Virginia.EDU [128.143.137.18]) by ares.cs.Virginia.EDU (8.8.5/8.8.5) with ESMTP id NAA18371 for ; Mon, 22 Jun 1998 13:35:52 -0400 (EDT) From: Greg Lindahl Received: (from lindahl@localhost) by adder.cs.Virginia.EDU (8.7.5/8.7.3) id NAA13258 for axp-list@redhat.com; Mon, 22 Jun 1998 13:35:52 -0400 (EDT) Date: Mon, 22 Jun 1998 13:35:52 -0400 (EDT) Message-Id: <199806221735.NAA13258@adder.cs.Virginia.EDU> X-Mailer: Mail User's Shell (7.2.5 10/14/92) To: axp-list@redhat.com Subject: Re: Making programs 64 bit clean > Unacceptable: > > int foo; > int *bar; > > foo = (int) bar; > > Acceptable?: > > 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? This is the easiest way to fix broken code. However, it isn't necessarily portable to other 64 bit machines -- I think everyone else (?) defines long == 32 bits and long long == 64 bits. Your best bet for a clean, easy solution is to typedef an int64 type and use that, with an appropriate definition for each machine. If you are clever you can put that into a configure script... It's much better in the long run to fix the programs to not cast pointers to ints of any width, but of course that is much more expensive than this quick hack. -- g