🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3078

Re: Casting Function Pointers

#3078
From: David Fiander
Date: Tue, 28 May 1991 12:49
32 lines
1698 bytes
In article <1991May27.153520.4547@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>In article <16271@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>>>I know of at least one -- it's no longer promised that casting a pointer to
>>>integer and back preserves its value if the integer is big enough...
>>
>
>I don't have them handy either.  I remember noticing that the "you can do
>this" promise had disappeared, but I have no idea when it was.
>
>Probably something to do with the AS/400. :-)

From what you've (or was it doug) said, that wouldn't surprise me, but
the same thing happens on the CDC Cyber series, and probably on the Prime
9600 series (I can't check, it's not up right now).  These machines use
rings for protection and, on the Cybers, converting from a pointer to an
int may be all right, but converting from an int to a pointer zeros the
ring bits in the pointer created.  This caused us all sorts of problems,
because the test

	p == (char *)-1

will have a different result from the test

	(int)p == -1

malloc broke because of this, and it took us two or three 12-hour days to
figure it out.

--
David J. Fiander
SCO MMDF Development Team
SCO Canada, Inc.
Technical Details
Message-ID: <1991May28.124930.19893@sco.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!lethe!tvcent!comspec!scocan!david
References: <1991May25.221756.16182@zoo.toronto.edu> <16271@smoke.brl.mil> <1991May27.153520.4547@zoo.toronto.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!lethe!tvcent!comspec!scocan!david
From: david@sco.COM (David Fiander)
Subject: Re: Casting Function Pointers
Organization: SCO Canada, Inc.
Date: Tue, 28 May 1991 12:49:30 GMT
Message-ID: <1991May28.124930.19893@sco.COM>
References: <1991May25.221756.16182@zoo.toronto.edu> <16271@smoke.brl.mil> <1991May27.153520.4547@zoo.toronto.edu>
Sender: news@sco.COM (News administration)