Article View: comp.std.c
Article #405Re: (char *)(-1)
From: Graham Bardsley
Date: Tue, 01 Aug 1989 17:24
Date: Tue, 01 Aug 1989 17:24
21 lines
1342 bytes
1342 bytes
Here's some other sloppyness in UNIX pointer types (by no means definative):
caddr_t mmap() returns -1 on error
char *shmat() returns -1 on error.
void (*signal())() can return either -1 (error), 0 (SIG_DFL), or
1 (SIG_IGN) although SIG_DFL and SIG_IGN are macros :-o
char *mktemp() returns -1 on error
Just what are you meant to to test error conditions with these beasts !
The only thing really is to cast the result to int and compare
but thats still not portable and some lints will not shut up about such things
(even if you tell them to).
----
Graham Bardsley,STC Telecoms,Oakleigh Road South,New Southgate, London, N11 1HB
..{mcvax}!ukc!stc!graham <graham@tcom.stc.co.uk> Tel: +44 1 368 1234 x2739
Technical Details
Message-ID:
<1661@bute.tcom.stc.co.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!mcvax!ukc!stl!stc!jed!grahamReferences:
<GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <18792@mimsy.UUCP> <120@psitech.UUCP> <10637@smoke.BRL.MIL>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!mcvax!ukc!stl!stc!jed!graham From: graham@jed.tcom.stc.co.uk (Graham Bardsley) Newsgroups: comp.std.c Subject: Re: (char *)(-1) Keywords: pointers, casts Message-ID: <1661@bute.tcom.stc.co.uk> Date: 1 Aug 89 17:24:19 GMT References: <GEOFF.89Jun11231924@onyx.cs.warwick.ac.uk> <2619@yunexus.UUCP> <18792@mimsy.UUCP> <120@psitech.UUCP> <10637@smoke.BRL.MIL> Sender: news@tcom.stc.co.uk Reply-To: graham@tcom.stc.co.uk (Graham Bardsley) Organization: STC Telecoms, New Southgate, London, England Lines: 21