dolik.rce Messages: 1791 Registered: August 2008 Location: Czech Republic
Ultimate Contributor
I'm ashamed that I missed so obvious solution Probably because I ussualy declare only 1 variable per line if I initialize them.
What if we extend this problem a bit?
Let's say, one would like to have there two variables of different type. Then it's impossible to write
for(bool b=true,int i=0;...;...){}
I tried this, but it seems that anything after "bool" is handled as declaration of bool.
Quote:
Anyway allocating 2+ variables in for-init can often lead to less readable source, so use with caution. I think it's better to avoid it whenever possible.
Yes, I'm aware of that I was just playing with this idea before I found the right way to do it using just one variable.
Anyway, thanks for quick response
Edit: Oups I've missed that mr_ped already thought about the two types case... sorry