rap.c, line 310: warning: absolute pointer used
rap.c, line 369: warning: absolute pointer used
Lines 310 & 369 are the exact same and look like this:
if ( shmaddr EQ (char *) -1 ) {
Can anyone shed some light on what is meant by an absolute
pointer. I am assuming it doesn't like the cast but I am not sure.
Incidently the "EQ" is defined as "==".
Dennis
The compiler is trying to warn you, in a somewhat cryptic way, that casting
any integer except the constant 0 into a pointer is a machine-dependent,
unportable, and dangerous operation.
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,decvax,pyramid}!utzoo!henry
However, in SysV the shmat(2) call returns (char *) -1 in case of error. I'll
bet a doughnut that this is where shmaddr is coming from.
Is anyone aware of any computer where this would not work as intended
(thus, couldn't support full SysV)? It could be argued that NULL (i.e., 0,
with its already agreed-upon special-caseness) would have been better (more
portable?) but it's too late now and I've never heard where it hurt anyone
either.
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
go for it! allegra,ulysses,vax135}!ttrdc!levy
>Lines 310 & 369 are the exact same and look like this:
> 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.
Kathy Harris
Hewlett Packard, Systems Software Operation
{hplabs, ihnp4}!hpfcla!kah
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
g...@sun.com (or g...@sun.arpa)