Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
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

List of 30 messages in thread
TopicAuthorDate
UART0 interrupt not generating            01/01/70 00:00      
   you never start a timer for the UARTs            01/01/70 00:00      
      i have set it in another init funtion            01/01/70 00:00      
         That sounds fishy, you set SCON0, but            01/01/70 00:00      
   sometimes, you are better off "growing"            01/01/70 00:00      
      i trimmed and tried            01/01/70 00:00      
         get rid of the stupid putchar and what g            01/01/70 00:00      
   config()            01/01/70 00:00      
      but you STILL have the stupid putchar            01/01/70 00:00      
         sorry! complete details now            01/01/70 00:00      
            I will not            01/01/70 00:00      
   further simplified            01/01/70 00:00      
      this is most probably not the root cause            01/01/70 00:00      
         oops            01/01/70 00:00      
            the "printf" of embedded world...            01/01/70 00:00      
               yes LED is flashing            01/01/70 00:00      
                  Obscure code...            01/01/70 00:00      
                     Thank you Russell. At last I completed            01/01/70 00:00      
                        Excellent!            01/01/70 00:00      
                           clarity            01/01/70 00:00      
                        Is it now clear to you what simplificati            01/01/70 00:00      
                        but WHY?????            01/01/70 00:00      
                           the reason            01/01/70 00:00      
                              but, Erik,...            01/01/70 00:00      
                                 You STILL want to know why it is impossi            01/01/70 00:00      
                                    nono, I wouldn't say that            01/01/70 00:00      
                                       and - of course            01/01/70 00:00      
                                          the tool            01/01/70 00:00      
                                             Added to the List            01/01/70 00:00      
   the original problem            01/01/70 00:00      

Back to Subject List