Question from JF:
Are you obliged to declare your variable at the start of a block?
-redj
Variable declaration at begining of code block
Re: Variable declaration at begining of code block
Yes you are, just like in C89.
I prefer the grouping at the top, as you can quickly visualize which variables are available within the scope of that block.
We however need to relax the grammar to support variables being declared further on, and issue warnings instead of cryptic syntax errors. We should also have an option to relax that option for people who really want to do that.
I prefer the grouping at the top, as you can quickly visualize which variables are available within the scope of that block.
We however need to relax the grammar to support variables being declared further on, and issue warnings instead of cryptic syntax errors. We should also have an option to relax that option for people who really want to do that.
-
- Posts: 19
- Joined: Wed Feb 09, 2011 11:47 am
Re: Variable declaration at begining of code block
I'm one of those that really want to do that .
I suspect is an Ecere thing and not a gcc -c89 thing, right?
I suspect is an Ecere thing and not a gcc -c89 thing, right?
Re: Variable declaration at begining of code block
It's an Ecere thing, though if you passed -c89 to GCC ( if there is such a thing I'm not sure ) it will bark at you for sure as well.
But do try to appreciate the beauty of well grouped variables at the top of your block
You can always start a new compound block inside as well. It helps you organize sections of code around the variables that are used!
But do try to appreciate the beauty of well grouped variables at the top of your block
You can always start a new compound block inside as well. It helps you organize sections of code around the variables that are used!