Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: tsaylor@ecst.csuchico.edu (Todd M. Saylor)
Subject: Dereferencing NULL pointer?
Date: 1997/05/21	[thread overview]
Message-ID: <5lteva$q0e@charnel.ecst.csuchico.edu> (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]
-- 



             reply	other threads:[~1997-05-21  4:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-21  4:00 Todd M. Saylor [this message]
1997-05-21  4:00 ` Dereferencing NULL pointer? 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
read-only archive

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