🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #396

Re: (char *)(-1)

#396
From: Chris Torek
Date: Mon, 31 Jul 1989 16:59
30 lines
2000 bytes
In article <120@psitech.UUCP> david@psitech.UUCP (david Fridley)
quotes me quoting someone else who asked about `(char *)-1'---I note
that my article, <18792@mimsy.UUCP>, is missing from the references:
field, apparently not inserted at psitech, so the question was probably
two articles back, in <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk>---
and then writes:

>To quote from the my UNIX System V (Release 3.0) Programmers Reference manual
[quote deleted]

Who said anything about Unix?  This is a C newsgroup.

>Here we see that sbrk(), a standard UNIX function, which returns a character
>pointer will return (-1).  This is the functioin used by malloc() to get 
>free more free memory from the operation system.

And in fact in <18792@mimsy.UUCP> I noted (in this [wrong] newsgroup)
that some Unix standards require that machines be able to represent
(char *)-1, and that someone, somewhere, has probably had to, or will
have to, do unspeakable things in software and/or hardware just for
backward compatibility.  That is, you may be able to run System V release
99-and-44/100ths on the FooBletch Mark IV, but all pointer operations
will run at 1/3 normal speed just to accomodate this botch.

The fact that the botch is Unix-specific, not C-specific, and that
it *is* a botch, should be enough to discourage anyone else from
using it.  There is no need to perpetuate the mistakes of the past.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris
Technical Details
Message-ID: <18828@mimsy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!mimsy!chris
References: <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <120@psitech.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!purdue!haven!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.std.c
Subject: Re: (char *)(-1)
Keywords: pointers, casts
Message-ID: <18828@mimsy.UUCP>
Date: 31 Jul 89 16:59:47 GMT
References: <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <120@psitech.UUCP>
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 30