Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ames!necntc!ima!haddock!karl
From: karl@haddock.ISC.COM (Karl Heuer)
Newsgroups: comp.std.c
Subject: casting int constants to pointers (was: switch (expression))
Message-ID: <5153@haddock.ISC.COM>
Date: 14 Jul 88 18:25:06 GMT
References: <1988Jul12.105547.13268@light.uucp> <755@vsi.UUCP> <59881@sun.uucp>
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Organization: Interactive Systems, Boston
Lines: 17

In article <59881@sun.uucp> guy@gorodish.Sun.COM (Guy Harris) writes:
>[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.

>Unfortunately, we're stuck with the sins of the past, such as system calls
>returning -1 even when they're returning pointers and special signal handler
>values such as "(int (*)())1" (changed to "(void (*)...", which still doesn't
>fix the problem in question),

In ANSI C, the values of SIG_DFL, SIG_IGN, and SIG_ERR are not specified.
Providing them as macros does fix the problem in question.

It would seem that the correct fix for sbrk() and shmop() is to similarly
provide SBRK_ERR and SHMOP_ERR.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint