*BSD News Article 83748


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!esmeralda.access.net.au!news.netspace.net.au!news.mira.net.au!news.vbc.net!vbcnet-west!samba.rahul.net!rahul.net!a2i!news.walltech.com!uunet!in3.uu.net!192.174.65.41!01-newsfeed.univie.ac.at!CARNet.hr!dave
From: dave@pc-damir.srce.hr (Drazen Kacar)
Newsgroups: comp.unix.solaris,comp.unix.bsd.misc,comp.unix.internals
Subject: Re: Solaris 2.6
Date: 28 Nov 1996 04:27:13 GMT
Organization: Cardak ni na nebu, ni na zemlji
Lines: 40
Distribution: world
Message-ID: <slrn59q566.3s2.dave@pc-damir.srce.hr>
References: <32986299.AC7@mail.esrin.esa.it> <casper.329abb76@mail.fwi.uva.nl> <x7917mx5gx.fsf@dumbcat.codewright.com>
Reply-To: dave@fly.cc.fer.hr
NNTP-Posting-Host: pc-damir.srce.hr
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Newsreader: slrn (0.8.7.1 UNIX)
Xref: euryale.cc.adfa.oz.au comp.unix.solaris:90675 comp.unix.bsd.misc:1612 comp.unix.internals:11348

In article <x7917mx5gx.fsf@dumbcat.codewright.com>, Marco S Hyman wrote:
>eggert@twinsun.com (Paul Eggert) writes:
>
>> While we're on the subject, when will Solaris migrate to the right way
>> of doing things: int = 32 bits, long = 64?  Perhaps this will be
>> another set of ifdefs in the Solaris 2.7 include files (:-)?
>
>Wellllll, I'll let you in on the secret ..... its a two stage process.
>
>Stage 1:
>Keep long 32 bits but now with 64 bit pointers so you can catch every
>program that assumes a pointer can be stored in a long or int.

How can I portably manipulate bits in pointers? Sometimes I need to
find the page boundary, eg.

char *p;

p = (char *)((long)p & -getpagesize());

If long can't hold the pointer, I can change it to long long, but it
will break on compilers that don't suport it.

And sometimes I need to align the structure, eg.

p = (struct foo *)(((long)p+sizeof(double)-1) & -sizeof(double));

How should I do it?

>Stage 2 (not to be started until the world's C software has been fixed
>	 regarding pointers and longs):
>Change longs to 64 bits so we can start over again, this time finding
>every line of code that assumes an IP address fits in a long or int.

-- 
Life is a sexually transmitted disease.

dave@fly.cc.fer.hr
dave@zemris.fer.hr