🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sources.bugs
Article #904

Re: Minor fixes to NetHack 1.4f

#904
From: Chris Miller
Date: Sun, 23 Aug 1987 11:10
34 lines
2202 bytes
In article <83@b.gp.cs.cmu.edu> ralf@b.gp.cs.cmu.edu (Ralf Brown) writes:
>
>The new 1.4f version of NetHack has a number of typos!
>...
>Finally, two minor changes for Turbo C:
>...
>Also, the fileinfo[] array of structures needs to be zeroed out (at least
>the "where" field) at the beginning.  Uninitialized global arrays are not
>zeroed out in Turbo C (and probably many other compilers), ...

This does not seem to be the case in Turbo C; the User Guide, page 168
states "In C, all global variables are initialized to 0 by default
unless you explicitly initialize them to a different value".  Any
compiler that did not implement this would not be a true C compiler.
I have attempted to determine empirically whether Turbo C conforms to its
own documentation in this respect, and as far as I can tell, it does
(of course, no amount of such testing can constitute proof).

In each memory model, and for each scalar type, some pointer types,
and a structure type containing char, int, long, float and double fields,
I declared an uninitialised global array and wrote a loop to compare
each element (each field of each element, for the structure) against
the constant 0 (uncast, and hence implicitly cast to the type of the
appropriate element).
In every case, all components of the array (and fields of the structure)
were initialised properly to 0.

I have not encountered the bug that you describe in NetHack, either.
Is this a problem with very early releases of Turbo C?

-- 
	Chris Miller, Heriot-Watt University, Edinburgh
	chris@cs.hw.ac.uk	<EUROPE>!ukc!hwcs!chris   chris@hwcs.uucp
	chris@uk.ac.hw.cs
Technical Details
Message-ID: <1438@brahma.cs.hw.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!mcvax!ukc!its63b!hwcs!chris
References: <83@b.gp.cs.cmu.edu>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!mcvax!ukc!its63b!hwcs!chris
From: chris@cs.hw.ac.uk (Chris Miller)
Newsgroups: comp.sources.bugs
Subject: Re: Minor fixes to NetHack 1.4f
Message-ID: <1438@brahma.cs.hw.ac.uk>
Date: Sun, 23-Aug-87 07:10:10 EDT
Article-I.D.: brahma.1438
Posted: Sun Aug 23 07:10:10 1987
Date-Received: Tue, 25-Aug-87 01:29:41 EDT
References: <83@b.gp.cs.cmu.edu>
Reply-To: chris@cs.hw.ac.uk (Chris Miller)
Organization: Computer Science, Heriot-Watt U., Scotland
Lines: 34