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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/21/11 11:48
Read: times


 
#181204 - call by value
Responding to: ???'s previous message
Note that C does call by value, so a const for a function parameter doesn't make much difference for the caller - it still sends a copy of a variable and can't get it's own variable modified.

It's only when you send a pointer that the const keyword (and the location of it) matters - if the pointer is const, or if the target value is const.

Note that your function is a bit of a maintainance nightmare, because it is so easy for a programmer to miss that one of your case statements doesn't have a break or return, but instead falls through to the default statement. How much do you save by the fall through, instead of having a return '0'?

List of 5 messages in thread
TopicAuthorDate
const function parameter declaration -2            01/01/70 00:00      
   call by value            01/01/70 00:00      
   Overloaded function            01/01/70 00:00      
      No overloading in C            01/01/70 00:00      
   case 10: return 0x30;            01/01/70 00:00      

Back to Subject List