quote:
MSW - there is a potential function call involved with using a function-based modification, yes, but for most short functions the compiler will try to inline it, negating the difference. The keyword ''inline'' can be added to demonstrate that you know the function-call overhead might prove a bother, but in the end it''s still up to the compiler to decide if it can or cannot inline the function. Usually it does, for short functions like in the example.
[edit: for functions that have their bodies within the class specification (i.e. usually in the header file i.s.o. the CPP file), inline is implied, meaning the compiler will try hard to remove any function-call overhead and some temporary-object construction overhead]
Now that is what bothers me...this dependancey on the compiler to do such things...when there is a chance (no matter how small) that it won''t...I''m a bit of a control freak when it comes to programming, and don''t feel comfortable with the compiler "second guessing" my code...but hey, thats me...