🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

3 total messages Started by FSAC Wed, 29 Oct 1986 19:20
absolute pointer
#9673
Author: FSAC
Date: Wed, 29 Oct 1986 19:20
22 lines
1235 bytes
     We are running HP-UP UNIX on a Hewlett-Packard System 9050. THe
HP-UP is SYSV look alike with shared memory operations.  I am trying to
compile a program that allows users to talk with each other.  This
program is similiar to talk except that is uses shared memory.  It
compiles and works under a AT&T SYS5 release 2.  However when I compile
it under hp-UNIX I get the following error messages:

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
Re: absolute pointer
#9720
Author: Kathy Harris
Date: Mon, 03 Nov 1986 16:27
16 lines
948 bytes
>rap.c, line 310: warning: absolute pointer used

>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
Re: absolute pointer
#9727
Author: Guy Harris
Date: Wed, 05 Nov 1986 21:26
24 lines
1607 bytes
> >		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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads