🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #13095

Re: catering to bad code

#13095
From: wunder
Date: Thu, 26 Feb 1987 23:38
37 lines
2069 bytes
The HP-UX C compilers have flags that allow you to force traps on null
pointer derefs, or to force accepting a null pointer deref (you get a 0
at that location).  The default behavior depends upon the actual
implementation.

Providing both choices to the user is obviously the best idea.

Walter Underwood
wunder@hplabs

-----------------------------------------

	  -z		 Do not	bind anything to  address  zero.  This
			 option	 will  allow runtime detection of null
			 pointers. See the note	on pointers below .

	  -Z		 Allow dereferencing of	null pointers. See the
			 note on pointers below.

     Pointers

	    Accessing  the  object  of	a  NULL	 (zero)	  pointer   is
	    technically	 illegal, (see Kernighan and Ritchie) but many
	    systems have permitted it in the past.  The	 following  is
	    provided   to  maximize  importability  of	code.  If  the
	    hardware is	able to	return zero for	reads of location zero
	    (when accessing at least 8 and 16 bit quantities), it must
	    do so unless the -z	flag is	present. The -z	flag  requests
	    that SIGSEGV be generated if an access to location zero is
	    attempted.	Writes of location zero	 may  be  detected  as
	    errors  even  if  reads  are  not.	If the hardware	cannot
	    assure that	location zero acts as if it was	initialized to
	    zero  or  is locked	at zero, the hardware should act as if
	    the	-z flag	is always set.

-----------------------------------------
The above man page excerpt is almost certainly copyrighted by HP.
Technical Details
Message-ID: <6620001@hpcea.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!pyramid!hplabs!hpcea!wunder
References: <14833@amdcad.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!pyramid!hplabs!hpcea!wunder
From: wunder@hpcea.UUCP
Newsgroups: comp.arch
Subject: Re: catering to bad code
Message-ID: <6620001@hpcea.HP.COM>
Date: Thu, 26-Feb-87 18:38:00 EST
Article-I.D.: hpcea.6620001
Posted: Thu Feb 26 18:38:00 1987
Date-Received: Sun, 1-Mar-87 09:28:22 EST
References: <14833@amdcad.UUCP>
Organization: HP Corp. Engineering - Palo Alto, CA
Lines: 37