name lookup of 'i' changed for new ISO 'for' scoping

dc42:

majenko:
The coding style starts with the user. If they don't know what they're doing, no amount of forced coding styles ... and warnings (which on the Arduino are pointless, because a) the line numbers are wrong, and b) people don't read them, they just post snippets of them on here and ask what is wrong), will make them better programmers.

But extra warnings help people who mostly do know what they are doing avoid making silly mistakes. I once had to convert 4 million lines of C++ code, written by programmers who were extremely competent, to be compatible with a new compiler and its associated libraries. At the same time, I increased the compiler warning level to near maximum. The new warnings revealed more than 200 bugs in the code. This was in code that had been tested and released.

That I agree with. I always code with -Wall turned on.

If the line number in Arduino messages are wrong sometimes, that should be fixed. I find the error message line numbers are mostly OK.

majenko:
(which I abhor - coding styles are personal)

I guess you are either a hobbyist or a one-developer company, because that attitude is not workable in a multi-developer team. In safety-critical work, companies mostly pick one of a few standard coding rule sets such as MISRA-C, MISRA-C++ and JSF C++.

One developer company at the moment, but I have worked in large development teams. I find my personal coding style fits in pretty well with others - and I am willing to change my coding style to fit in with management's desires - but at the end of the day I believe that the coding style that is most comfortable for an experienced programmer to work with is the one least prone to them making mistakes in.

"Standard" coding styles are only really there so that other developers in the team can understand easily what you have written. That and comments (something else I am not good at :wink: ).

What gets most confusing though is when you are part of a project team with multiple programming languages involved, and you have different programming styles imposed upon you for each language - either by management (which I find is often the case of you conforming to your boss's style of programming, and not to any particular "standard" - at least in the industries I have worked in), or the differences in language structures.