(char *)(-1)

Graham Bardsley graham at jed.tcom.stc.co.uk
Wed Aug 2 03:24:19 AEST 1989


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 at tcom.stc.co.uk>   Tel: +44 1 368 1234 x2739



More information about the Comp.std.c mailing list