From -8165736251234043605
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,de99e5c46dfe5a28
X-Google-Attributes: gidf78e5,public
From: Oleg Zabluda <zabluda@math.psu.edu>
Subject: Re: Multiple declarations in for loop?
Date: 1998/05/21
Message-ID: <6jutcg$96n@marianna.psu.edu>#1/1
X-Deja-AN: 355207362
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <356196A0.4214@lehman.com> <6jsdc4$fvr@engnews1.Eng.Sun.COM>
X-Original-Date: 20 May 1998 11:37:52 -0400
X-Server-Date: 20 May 1998 21:03:47 GMT
Organization: Penn State University, Center for Academic Computing
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANWQURuEDnX0m9pzZAQE6NwF7BRHsYCh8J1tBUSptq2gttrzW8179NOb1 Gw5DR6szcOL4swHhWhXfsUaqfckfXK65 =i2I0
Reply-To: zabluda@math.psu.edu (Oleg Zabluda)
Newsgroups: comp.std.c++


Steve Clamage <clamage@Eng.Sun.COM> wrote:
: In article 4214@lehman.com, Cristian Georgescu <cgeorges@lehman.com> writes:
: >> Only one simple-declaration is allowed. The following declares i and j as
: >> you wish
: >> for (int i=0, j=0; i<10,j<10; i++, j++) ...
: >
: >Is there a reason for this limitation (only one simple declaration);
: >why not:
: >
: > for (int i=0, unsigned int j=0; i<10,j<10; i++, j++) ...

: You can't write
: 	int i=0, unsigned int j=0;
: in any context, so it would be odd to allow it in a for-loop header.
: The comma in a declaration separates declarators, it doesn't end
: a declaration.

It would be odd, but I think it would be worth it, because
it is frequently needed, and the alternatives are pretty
ugly. If the goal is to reduce oddity, maybe allowing
it in all other relevant contexts would be a solution :-) ?
Unless it would break something else, of course.

Oleg. 
-- 
Life is a sexually transmitted, 100% lethal disease.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



