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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/23/07 14:47
Read: times


 
#131279 - Yup
Responding to: ???'s previous message
Andy said:
Since you say that the only reasonable uses are one step forward, or one step backward, why not just make the parameter specify the direction - in effect, make it a 'bool' So TRUE goes forward, FALSE goes backwards...

That would certainly work. The only downside would be slightly uglier code in the place where the input paramteer is used. To my eyes, at least, it's a tiny bit more elegant (and a tiny bit more efficient if that matters) to write
     index += increment; 
than it is to write
     index += goForward ? 1 : -1; 
I think this kind of stuff is one reason that so many people advocate line-by-line code inspections. I'm certainly a fan of them, although I don't use them very often because I work by myself most of the time.

-- Russ


List of 22 messages in thread
TopicAuthorDate
8051 & L6219 (Stepper Motor Driver)            01/01/70 00:00      
   CNCZone            01/01/70 00:00      
   Maybe this will help            01/01/70 00:00      
      this helps a lot            01/01/70 00:00      
         Think Search and Replace            01/01/70 00:00      
            static            01/01/70 00:00      
               static about 'static' and 'code'            01/01/70 00:00      
                  That's modularity for you!            01/01/70 00:00      
                  Different Reason            01/01/70 00:00      
         Concepts            01/01/70 00:00      
      Imprecise comment            01/01/70 00:00      
         Another imprecise comment            01/01/70 00:00      
            Ah... That is the catch :)            01/01/70 00:00      
            Better            01/01/70 00:00      
               Yup            01/01/70 00:00      
                  Works Beautifully            01/01/70 00:00      
                     Another happy ending            01/01/70 00:00      
                        One more problem - Direction            01/01/70 00:00      
                           Extra Table Shouldn't Be Necessary            01/01/70 00:00      
                              thats what i thought too            01/01/70 00:00      
      nevermind i screwed up...            01/01/70 00:00      
   Visit Jones on Stepping Motors            01/01/70 00:00      

Back to Subject List