How constant is "const"?

mcdaniel at uicsrd.csrd.uiuc.edu mcdaniel at uicsrd.csrd.uiuc.edu
Thu May 5 07:39:00 AEST 1988


In draft ANSI C, are the following legal?

	const int i = 10;
	const int j = i;
	int a[i];

If they are not legal, why not?  If they are, why do K&R use
"#define"s for these kinds of applications?

The new K&R doesn't say whether a "const" identifier can appear in a
constant-expression.

-- 
Tim, the Bizarre and Oddly-Dressed Enchanter
Center for Supercomputing Research and Development
at the University of Illinois at Urbana-Champaign

Internet, BITNET:  mcdaniel at uicsrd.csrd.uiuc.edu
UUCP:    {ihnp4,uunet,convex}!uiucuxc!uicsrd!mcdaniel
ARPANET: mcdaniel%uicsrd at uxc.cso.uiuc.edu
CSNET:   mcdaniel%uicsrd at uiuc.csnet



More information about the Comp.lang.c mailing list