What does Z["ack"] = 5 mean?

Thomas Hameenaho thomas at uplog.se
Thu Oct 13 19:54:41 AEST 1988


In article <14999 at agate.BERKELEY.EDU> laba-3aw at web.berkeley.edu (Sam Shen) writes:
#Exactly what does this mean:
#
#main()
#{
#	char Z;
#
#	Z["ack!"] = 5;
#}
#

#Worse yet, the executable produced by gcc core dumps.  Oh, by the way, this
#is all on a Sun-3/50.
#


The problem in the gcc case is that gcc puts strings in the text segment and
text is normally read-only.

Our gcc/cc for 68k also doesn't initialize Z to anything useful, it just grabs
what happens to be on the stack.
-- 
Real life:	Thomas Hameenaho		Email:	thomas at uplog.{se,uucp}
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden



More information about the Comp.lang.c mailing list