Conversion to reference

Started by
10 comments, last by sQuid 20 years, 8 months ago
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]
How do I set my laser printer on stun?
Advertisement
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