Article View: net.lang.c++
Article #183Re: Unintuitive semantics for initializing in for statements
From: Jim Mayer
Date: Mon, 05 May 1986 17:52
Date: Mon, 05 May 1986 17:52
26 lines
1575 bytes
1575 bytes
Several notes have mentioned using loop variables after the loop as
a reason for making:
for (int i = ...)
equivalent to
int i;
for (i = ...)
It seems to me that if the loop variable is really needed after
the "for" statement, then the second form is just about as easy to
write and expresses the use of the variable much more clearly.
I consider the current semantics a real wart. Actually, after programming
fairly intensively in C++ for a month or so, I feel that scoping in general
is the single weakest point of the language. The way enumeration types
(and constants in general) are handled within classes is particulary
poor. Are the scope issues going to be addressed more fully in
subsequent releases?
-- Jim Mayer University of Rochester
(arpa) mayer@Rochester.ARPA Department of Computer Science
(uucp) rochester!mayer Ray P. Hylan Building
(via allegra, decvax, or seismo) Rochester, New York 14627
Technical Details
Message-ID:
<17863@rochester.ARPA>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!rochester!mayerReferences:
<17195@rochester.ARPA> <5334@alice.uUCp> <163@zaiaz32.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!seismo!rochester!mayer From: mayer@rochester.ARPA (Jim Mayer) Newsgroups: net.lang.c++ Subject: Re: Unintuitive semantics for initializing in for statements Message-ID: <17863@rochester.ARPA> Date: Mon, 5-May-86 13:52:26 EDT Article-I.D.: rocheste.17863 Posted: Mon May 5 13:52:26 1986 Date-Received: Thu, 8-May-86 06:42:23 EDT References: <17195@rochester.ARPA> <5334@alice.uUCp> <163@zaiaz32.UUCP> Reply-To: mayer@rochester.UUCP (Jim Mayer) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 26