From -6783064668260016599
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,de99e5c46dfe5a28
X-Google-Attributes: gidf78e5,public
From: clamage@Eng.Sun.COM (Steve Clamage)
Subject: Re: Multiple declarations in for loop?
Date: 1998/05/19
Message-ID: <6jsdc4$fvr@engnews1.Eng.Sun.COM>#1/1
X-Deja-AN: 354701508
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <356196A0.4214@lehman.com>
X-Original-Date: 19 May 1998 16:52:20 GMT
Organization: Sun Microsystems Inc.
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANWHOLeEDnX0m9pzZAQEE6wGAmWfa1qV4Nd+JZz+eUn9W3yLsSmybPPSl S0M2aMc5oPaQTti9OUVpWO4cxgEVoZtN =zwcb
Reply-To: clamage@Eng.Sun.COM
Newsgroups: comp.std.c++


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.

---
Steve Clamage, stephen.clamage@sun.com
---
[ 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              ]



