Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!nike!oliveb!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c Subject: Re: absolute pointer Message-ID: <8959@sun.uucp> Date: Wed, 5-Nov-86 16:26:40 EST Article-I.D.: sun.8959 Posted: Wed Nov 5 16:26:40 1986 Date-Received: Wed, 5-Nov-86 22:48:37 EST References: <5009@brl-smoke.ARPA> <880002@hpfclq.HP.COM> Organization: Sun Microsystems, Inc. Lines: 24 > > if ( shmaddr EQ (char *) -1 ) { > > > The HP9000 Series 500 C compiler issues this warning whenever an > integer constant other than 0 is used as a pointer. Its intent > is to flag statements that are machine dependent in code ported > from other systems. Unfortunately, the shared memory system calls in System V have a *really poor* convention for indicating errors; they *should* have returned NULL, but instead they return -1 cast to "char *". The intent may have been to make them "just like" system calls that return integral values, but this doesn't buy you anything (other than being able to use the same user-mode stub code for calls that return integral values and that use pointers, but this only saves you a handful of bytes). As such, while this code is flagging code that may be machine dependent, you can't do anything about it (at least not while remaining compatible with the SVID), so the warning is merely noise. The compiler should NOT issue this warning if -1 is being cast to a pointer. -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)