Article View: comp.std.c++
Article #2473Re: New treatment of 'for (int i ...'
From: Steven Correll
Date: Thu, 09 Nov 1995 05:47
Date: Thu, 09 Nov 1995 05:47
34 lines
1781 bytes
1781 bytes
What was the rationale for this change, which from here looks quite gratuitous? It's reminiscent of the old Pascal rule that the value of a loop index was undefined after the loop exited; that was apparently motivated by the belief that compilers were too stupid to figure out on a case-by-case when a value could safely be killed. The change makes it difficult to write programs that will work in both old compilers and new ones while implementors scurry to catch up with the ever-inventive committee. This technique won't work in current compilers: for (unsigned i = 0; ...; ...) ... for (i = 0; ...; ...) ... And this won't work in older ones: for (unsigned i = 0; ...; ...) ... for (unsigned i = 0; ...; ...) ... Must portable programs do this? for (unsigned i0 = 0; ...; ...) ... for (unsigned i1 = 0; ...; ...) ... -- Steven Correll == PO Box 66625, Scotts Valley, CA 95067 == sjc@netcom.com --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<sjcDHqMKM.MBG@netcom.com>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backReferences:
<47itjt$65m@lhc.nlm.nih.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 09 Nov 95 05:47:30 GMT Approved: fjh@cs.mu.oz.au Newsgroups: comp.std.c++ From: sjc@netcom.com (Steven Correll) Subject: Re: New treatment of 'for (int i ...' Message-ID: <sjcDHqMKM.MBG@netcom.com> Organization: NETCOM On-line Communication Services (408 261-4700 guest) References: <47itjt$65m@lhc.nlm.nih.gov> X-Original-Date: Wed, 8 Nov 1995 18:41:10 GMT Apparently-To: comp-std-c++@uunet.uu.net X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMKGWFOEDnX0m9pzZAQGwBwF/Xq3VDTOHkJ4v1YFlicG0PHF5RQWWsL51 Nn040ob0Xmbtlesq1BRgdpj9I+lGZuoG =AIFn