casting int constants to pointers (was: switch (expression))

Bob Lenk rml at hpfcdc.HP.COM
Tue Jul 19 08:13:49 AEST 1988


> >[sbrk(), as well as shmop(), returns (char *)-1 on error]
> 
> Neither sbrk() nor shmop() is part of the ANSI C library.  I hope POSIX will
> fix this.

The 1003.1 standard includes neither sbrk() nor shmop.  Sbrk() is
unlikely to be covered by any standard, since nothing beyond malloc()
can be defined portably or is needed for portable code (even the SVID
omits sbrk() for this reason).  The 1003.4 (real-time extensions to
1003.1) standard will include functionality similar to shmop, but
probably not the same interface.  The function similar to shmat()
is currently defined to return NULL on error; in any case a non-portable
cast to a -1 will never be required.

One function that did require changing before inclusion in a consensus
standard is signal() in ANSI C.  It is defined to return SIG_ERR, and
the SVID has followed this direction.

		Bob Lenk
		{ihnp4, hplabs}!hpfcla!rml
		rml%hpfcla at hplabs.hp.com



More information about the Comp.std.c mailing list