absolute pointer

Daniel R. Levy levy at ttrdc.UUCP
Sun Nov 2 09:57:36 AEST 1986


In article <7267 at utzoo.UUCP>, henry at utzoo.UUCP (Henry Spencer) writes:
>> rap.c, line 310: warning: absolute pointer used
>> 
>> 		if ( shmaddr EQ (char *) -1 ) {
>
>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



More information about the Comp.lang.c mailing list