3 ms·
By "mix declarations with code", do you mean the ability to put local variables like `int x;` in locations other than immediately at the start of a function? I
by Twisol 8y ago
By "mix declarations with code", do you mean the ability to put local variables like `int x;` in locations other than immediately at the start of a function? I don't understand why this is a bad thing.
- capsicum80 8y agoThis, and especially in the first argument of 'for'. Not back compatible, very inelegant and luckily discouraged in many projects' coding guidelines.
- capsicum80 8y agoActually it is block, not function. It makes it very difficult to read the code if you are looking for the scope of the variables, or investigating stack usage.
- Mikhail_Edoshin 8y ago(In C you can have local variables inside any block, e.g. 'if' or 'for'.) It's subjective, of course, but I find it much clearer to have a dedicated place to look for variables.