Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!princeton!allegra!alice!ark From: ark@alice.UUCP Newsgroups: comp.lang.c++ Subject: Re: Why put constants on the stack? Message-ID: <6959@alice.UUCP> Date: Sun, 7-Jun-87 02:56:28 EDT Article-I.D.: alice.6959 Posted: Sun Jun 7 02:56:28 1987 Date-Received: Sun, 7-Jun-87 20:05:11 EDT References: <165700009@uiucdcsb> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 12 In article <165700009@uiucdcsb>, kenny@uiucdcsb.UUCP writes: > Why are ``const'' variables (other than parameters, of course) not > assumed to be static? In addition to the above annoyance, it seems > like a pointless waste of stack space. Have I overlooked something? Saying a variable is a ``const'' is saying that its value won't change over its lifetime. It doesn't promise to initialize it to a constant. There's no problem in saying int n; cin >> n; const k = n * 2;