(char *)(-1)
Chris Torek
chris at mimsy.UUCP
Tue Aug 1 02:59:47 AEST 1989
In article <120 at psitech.UUCP> david at psitech.UUCP (david Fridley)
quotes me quoting someone else who asked about `(char *)-1'---I note
that my article, <18792 at mimsy.UUCP>, is missing from the references:
field, apparently not inserted at psitech, so the question was probably
two articles back, in <GEOFF.89Jun11231924 at 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 at 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 at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.std.c
mailing list