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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/03/04 08:43
Read: times


 
#61819 - RE: OT: C parameter by reference or by v
Responding to: ???'s previous message
A specific instance that can think of is where I create a subroutine just to breakup a larger program, and that subroutine is not called from anywhere else.


A decent optimising compiler should inline this routine. No parameter passing ever takes place then. If your compiler can't do it, and speed matters to you more than good look of the C code, do this yourself.
Even if the routine appears more than once, and you aren't short at eeprom, you can inline it where it belongs.

Another method of speeding up the program is unrolling the loop.

MOV R0,#5
LOOP:
RR A
DJNZ R0,LOOP
will take WAY longer than

RR A
RR A
RR A
RR A
RR A

(digressing from SWAP, ANL etc)

same applies to C for() etc.

List of 21 messages in thread
TopicAuthorDate
OT: C parameter by reference or by value            01/01/70 00:00      
   RE: OT: C parameter by reference or by value            01/01/70 00:00      
      Parameters on stack            01/01/70 00:00      
      RE: OT: C parameter by reference or by value            01/01/70 00:00      
   Whats wrong with good ol pointer/global?            01/01/70 00:00      
      RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
         RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
            RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
               RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
            Pointer vs Reference            01/01/70 00:00      
               RE: Pointer vs Reference            01/01/70 00:00      
                  RE: Pointer vs Reference            01/01/70 00:00      
                     RE: Pointer vs Reference            01/01/70 00:00      
         RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
         RE: Whats wrong with good ol pointer/global?            01/01/70 00:00      
            RE: recursive functions            01/01/70 00:00      
   RE: OT: C parameter by reference or by v            01/01/70 00:00      
      RE: OT: C parameter by reference or by v            01/01/70 00:00      
      RE: OT: C parameter by reference or by v            01/01/70 00:00      
         RE: OT: more useful to have explicit ..            01/01/70 00:00      
         RE: OT: C parameter by reference or by v            01/01/70 00:00      

Back to Subject List