Re:Dangerous Embedded C Coding Standard Rules (2011)
by ant512 on Monday December 30, 2013 @02:32PM
(#6986350)
I'd suggest that, if a variable with an undefined value is a valid state for the program, the declaration is in the wrong place. How about this alternative?
[ Parent
| on HN ]
Re:Dangerous Embedded C Coding Standard Rules (2011)
by optymizer1 on Monday December 30, 2013 @11:08PM
(#6988897)
That's the obvious next step, but it's not valid C89 and that may or may not be relevant for people doing embedded programming. Personally, I'm all for using newer standards and declaring variables locally when it makes sense. Sometimes I like to see all variables at the top of the function though.