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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/02/04 13:17
Read: times


 
#61733 - RE: OT: C parameter by reference or by value
Responding to: ???'s previous message
Well, in case of long intergers or float numbers its best to pass the paramter by reference. But most of the times its just a byte of date to pass, can do with passing by value.

Another aspect of C is all parameters are passed on stack, as far as possible see if your compiler supports register paramter passing, it will save you some stack as well as some cycles.

Bottomline: it depends on the situation, and the type of data to be passed.

gary

P.S. Some newer MCS-51 variants support more than 256 bytes of internal memory, address wont be 1 byte in this case, so if the parameter is 8 bit, do it by value.

gary

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