??? 03/16/06 13:24 Read: times |
#112301 - clarity Responding to: ???'s previous message |
MISRA C tells us this way is recommended as there is no confusion what the 'if' statement relates to.
if(r_out >= RBUF_SIZE) { r_out = 0; } Just a little change to the coding style can make a big difference to detecting and/or avoiding defects. Because I like a format where "everyting" can bee on one screen, I used to do the if (..) ... ; and after, I do not know how many, misreads of my own code I have outlawd it so the only legal way for me now is if (..) { ... } Ever so many state "you must write clearly for other people" sure, but as we all are more or less egotistical, would it not be better just to say "you must write clearly for yourself" I am sure that non-clear code hit the originator in a fleshy muscle much more often that it hit others. That the originator usually, but not always, can relieve the pain faster than others, does not diminish the pain. The point is that if that as you probably spend as much time debugging as coding, why make coding "easier" and debugging more "difficult" Erik |