What is a POD-Type? [C++ FAQ Lite]
I guess he only wanted to point out that there's no actual gain when doing it with int, float etc... Maybe slower because char -> 8bit, char& -> 32bit, but does it matter on a 32bit machine?.
The real gain is with classes, since when passing by reference the computer won't have to create a copy of the class (constructor,destructor time-penalty) each time it's passed.
[edited by - Wildfire on August 19, 2003 10:34:45 AM]
Conversion to reference
Yes, my comment was misleading because POD types are not restricted to the built-in types alone. So, I apologize and I will clarify my statement to say you don''t need to pass a const reference for built-in types such as int, float, char, pointers, etc.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement