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

Back to Subject List

Thread Closed: Issue successfully resolved

???
01/23/04 11:30
Read: times


 
#63190 - RE: Not guilty, mlud
Responding to: ???'s previous message
anyone that writes
"for(;P("n").R-;P("|"))for(e=3DC;e-;P("_"+(*u++/8)%2))P("| "+(*u/4)%2);
should be shown the door."

I agree entirely.

"I have a real phobia for something called "real C" which to the best of my understanding consist of the following:
1) The more you can get into one statement the better."

I agree entirely.

"2) 'i', 'j' and 'k' are descriptive names."

Indeed not, but some single character variable names (such as 'i' as a loop counter) have become de-facto standards, as such they are readily recognised by experienced 'C' programmers. This improves code 'readibility'.

"3) C is self-documenting."

Choosing appropriate variable and function names does provide some level of self documentation and reduces clutter. 'Assembler' style commenting is excessive and counter productive in a well written 'C' program.

"4) If a language feature exist it must be used in every program."

Those are C++ programmers you're thinking about, aren't they?

"5) Timing loops in C are precise."

That's just a programmer competency issue which applies with any language.

"6) If you need to test a bit 200 times and it is located in a structure inside a structure there is no need to pull it out once, just do it every time."

Given excellent optimising compilers like Keil there are very few occasions where the code needs to be hand optimised. Take a look at the assembler generated for code such as this at full optimisation and I'll bet you won't be able to detect that that bit was ever in a nested structure.

"7) Global variables are to be avoided at all costs, if that means you have to carry 7 variables through 22 levels of nesting that is OK."

Only badly written code would have 22 levels of nesting. Global variables do have their uses but from the maintainability/comprehensibility point of view they are best avoided wherever practical. Aside from anything else they defeat overlay optimisation on the 8051.


List of 29 messages in thread
TopicAuthorDate
MISRA C Guidelines            01/01/70 00:00      
   RE: MISRA C Guidelines            01/01/70 00:00      
      RE: Alternate C Guidelines            01/01/70 00:00      
         RE: Alternate C Guidelines            01/01/70 00:00      
         RE: Alternate C Guidelines            01/01/70 00:00      
            RE: Alternate C Guidelines            01/01/70 00:00      
      RE: MISRA C Guidelines            01/01/70 00:00      
         RE: MISRA C Guidelines            01/01/70 00:00      
            RE: MISRA C Guidelines            01/01/70 00:00      
               RE: MISRA C Guidelines            01/01/70 00:00      
            RE: MISRA C Guidelines            01/01/70 00:00      
   Hitex have a deal...            01/01/70 00:00      
      RE: Hitex have a deal...            01/01/70 00:00      
         RE: Hitex have a deal...            01/01/70 00:00      
            RE: Hitex have a deal...            01/01/70 00:00      
               RE: Hitex have a deal...            01/01/70 00:00      
                  RE: Hitex have a deal...            01/01/70 00:00      
               Not guilty, mlud            01/01/70 00:00      
                  RE: Not guilty, mlud            01/01/70 00:00      
                     RE: Not guilty, mlud            01/01/70 00:00      
                        RE: Not guilty, mlud            01/01/70 00:00      
                        RE: Not guilty, mlud            01/01/70 00:00      
                     RE: Not guilty, mlud            01/01/70 00:00      
                     RE: Not guilty, mlud            01/01/70 00:00      
                        RE: Not guilty, mlud            01/01/70 00:00      
               RE: Hitex have a deal...            01/01/70 00:00      
   Jack Ganssle on the MISRA Guidelines            01/01/70 00:00      
   RE: MISRA C Guidelines            01/01/70 00:00      
      RE: MISRA C Guidelines            01/01/70 00:00      

Back to Subject List