Path: 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: <2619@yunexus.UUCP> <120@psitech.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 30 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 --- 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