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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/23/08 07:30
Read: times


 
#156963 - Blank Lines: My Opinion
Responding to: ???'s previous message
I agree with You, Erik that too much of blank lines makes it impossible to see through enough code.

But at the same time I feel it is necessary to have blank lines in between codes for clear view to reader.

E.G. considor following conditions in some init_sfr() routine
Condition 1:

void init_sfr(void)
{
 EA = 0;

 //INITIALISING TIMER-0 RELATED SFR
 TMOD = ....;
 TH0 = ....;

 //INITIALISING UART RELATED SFR
 PCON &= 0x7F;
 TH1 = ....;
 SCON = ....;

 //STARTING TIMERS
 TR0 = 1;
 TR1 = 1;

 //INTERUPT ENABLING
 ET0 = 1;
 ES = 1;
 EA = 1;
}


Condition 2:

void init_sfr(void)
{
 EA = 0;
 TMOD = ....;
 TH0 = ....;
 PCON &= 0x7F;
 TH1 = ....;
 SCON = ....;
 TR0 = 1;
 TR1 = 1;
 ET0 = 1;
 ES = 1;
 EA = 1;
}


Condition 3:

void init_sfr(void)
{
 EA = 0;


 //INITIALISING TIMER-0 RELATED SFR

 TMOD = ....;

 TH0 = ....;


 //INITIALISING UART RELATED SFR

 PCON &= 0x7F;

 TH1 = ....;

 SCON = ....;


 //STARTING TIMERS

 TR0 = 1;

 TR1 = 1;


 //INTERUPT ENABLING

 ET0 = 1;

 ES = 1;

 EA = 1;
}



in above example I prefer Condition 1 type of appearance as it visually fragments tasks done by the routine, at the same time enables to view sufficient code.

condition 3 type should be avoided

List of 14 messages in thread
TopicAuthorDate
serial communication            01/01/70 00:00      
   Have you tried the simulator?            01/01/70 00:00      
   Some Comments might help            01/01/70 00:00      
      what happened to indentions ???            01/01/70 00:00      
         Readability            01/01/70 00:00      
            there is a famous story            01/01/70 00:00      
   My head hurts            01/01/70 00:00      
   6 Ways to Write (& post) More Comprehensible Code            01/01/70 00:00      
      Re: 6 Ways to Write (& post) More Comprehensible            01/01/70 00:00      
   a personal opinion            01/01/70 00:00      
      Problem aided by bigger screen...            01/01/70 00:00      
         key word 'modest' I totally agree            01/01/70 00:00      
      Blank Lines: My Opinion            01/01/70 00:00      
         Avoided? Feed the wolves with him            01/01/70 00:00      

Back to Subject List