Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Dereferencing NULL pointer?
@ 1997-05-21  4:00 Todd M. Saylor
  1997-05-21  4:00 ` Steve VanDevender
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Todd M. Saylor @ 1997-05-21  4:00 UTC (permalink / raw)



I am currently in the process of porting an application to Digital UNIX
4.0b (it's never been run on an alpha before).  The app runs fine on HP/UX,
AIX, DG/UX (motorola and Intel), AT&T/NCR.  One problem has come up on
previous ports, that is the ability to dereference a NULL pointer.  For the
OS's that hate this, we've always found a linker option to allow it
(basically return a null character) - for example on DG it would be '-z
lowzeros'.

The following code demonstrates what I mean:

main()
{
char *x;

x = (char *)NULL;

printf("Null string = '%s'\n", x); /* This works fine */
printf("Null Char = '%c'\n", *x); /* This get a seg. violation */
}

Now this may be bad form, but I was wondering if anyone knows of a
switch/option to allow it?

TIA

[Posted for Aaron Johnson / aaron@bi-tech.com]
-- 



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1997-05-29  4:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-05-21  4:00 Dereferencing NULL pointer? Todd M. Saylor
1997-05-21  4:00 ` Steve VanDevender
1997-05-22  4:00   ` Todd M. Saylor
1997-05-23  4:00     ` Dan Pop
1997-05-28  4:00       ` Vikas Sontakke TOEM
1997-05-29  4:00 ` Craig Neth USG
1997-05-29  4:00 ` Craig Neth USG

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox