[comp.sources.games.bugs] Nethack 3 PL 9 on SCO Unix and const declarations

libove@libove.det.dec.com (Jay Libove) (07/09/90)

I brought my nethack 3 sources up to patchlevel 9 on a SCO Unix 3.2.0
(80386 based) machine, compiled, ran, and found the following three problems:

1) any call to the yn_function() function ended up losing the 'resp'
parameter - tracing in a debugger showed that the resp parameter was empty.
The def parameter however was maintained properly.

2) having, method not being given because the overall solution took care
of this too, gotten past the yn_function() problem, trying to save the
game caused an IOT trap and killed the program.

3) an inventory listing titled every section 'Illegal Objects'

The solution to all of these problems was to add  -Dconst=   to the
compiler command line... it seems that the SCO C compiler (the default,
Microsoft C compiler) doesn't handle the 'const' declarations used in
nethack 3 (patchlevel 9) properly.

I hope this is of some use to others who try to run nethack on a SCO
platform... the problems I listed above immediately went away when I
recompiled with -Dconst= so now I have to play some to see if I can
uncover any more SCO problems...

Does anyone have an explanation why the use of the const keyword caused
SCO's compiler to generate non-working code?

-Jay Libove     libove@kamet.enet.dec.com  decwrl!kamet.enet.dec.com!libove

goer@sophist.uucp (Richard Goerwitz) (07/10/90)

In article <11@lemans.dec.com> libove@kamet.enet.dec.com writes about
problems he encountered bringing NetHack up under SCO Unix.

I wonder:  Have you tried bringing up NetHack using gcc?  Rather than
spend hours looking for bugs introduced by the default compiler, why
not just use gcc?

Not a flame.  It's just that gcc produces smaller and faster executable
under Xenix, at least, and the optimizer seems to introduce far fewer
problems.  There is support in the makefile, moreover, for gcc, so you
can pretty much just change a few parameters, make, and then go.

   -Richard L. Goerwitz              goer%sophist@uchicago.bitnet
   goer@sophist.uchicago.edu         rutgers!oddjob!gide!sophist!goer