🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.misc
Article #155

Re: Need help with C bug.

#155
From: Chris Torek
Date: Sat, 01 Apr 1989 17:08
21 lines
1178 bytes
->	char	p[50];
->		if (p)
->			printf("ok\n");
->		else
->			printf("bad berries\n");
->	bad berries

In article <24971@pbhya.PacBell.COM> dbsuther@PacBell.COM
(Daniel B. Suthers) writes:
-At a guess:
-In the if() test you are looking at (probably) the hi order byte represented
-by the address of p[0];   this appears to be 0x0000.  
-
-Do you really want to check to ensure that there is a value stored at &p[0]?
-( if(p[0])  ) or do you want to ensure you have an array ( if(p != NULL) )

He really wants `if (p!=NULL)', which is what `if (p)' *means*!
It *is* a compiler bug.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris
Technical Details
Message-ID: <16667@mimsy.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris
References: <349@iconsys.UUCP> <24971@pbhya.PacBell.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!mimsy!chris
From: chris@mimsy.UUCP (Chris Torek)
Newsgroups: comp.bugs.misc
Subject: Re: Need help with C bug.
Keywords: pcc2 char array code generation
Message-ID: <16667@mimsy.UUCP>
Date: 1 Apr 89 17:08:33 GMT
References: <349@iconsys.UUCP> <24971@pbhya.PacBell.COM>
Distribution: usa
Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
Lines: 21