[rec.games.hack] Gcc needs -traditional for unexpected reason

kevin@kosman.UUCP (Kevin O'Gorman) (09/06/89)

I tracked down the reason why I could not restore saved games in my
copy of Nethack 3.0 to a problem with an implied initialization in decl.c.
The problem does not occur if the -traditional switch is used, although
this is not one of the documented effects of that switch, and I don't
know enough about the ANSI standard to know if it is reasonable.

The offending line is:
const char nul[40] = DUMMY;		/* contains zeros */

Where DUMMY is #defined to be {0};

In my version, gcc 1.35, all I get is two bytes of zero, where I would
expect 40.  With the -traditional switch, I haven't checked exactly what
I get, but it must be more because save and restore now work.

For the gcc people, please check if the behavior is reasonable, and if so
include it in the description of the -traditional switch.  If not, fix it
(sorry, I cannot understand your compiler well enough to help with that).

For the HACK 3.0 people, you could give better advice than what I found
(and relied on) here in the Makefile:

# if you are using gcc as your compiler:
#	add -fwritable-strings to your other CFLAGS
#	uncomment the CC definition below if it's not in your environment
#	ignore warnings about initializing non-const *s from const *s
#	if you get setcgtty() warnings during execution, you are feeding gcc
#		a non-ANSI <sys/ioctl.h> -- either run fixincludes on it or use
#		-traditional in CFLAGS