chapter11, Isn’t optimization needed anywhere?

With recent compilers, the optimizations are terrific, so it may be best to let the compiler do it without having to do the risky optimization yourself.

For example, the following code, seems inefficient, but the compiler optimization expands the constructor on the returned object. It doesn’t bother to create an object on the stack and then “pass by value” to the return value.

When “pass by reference” becomes available, they seem to think that this is an efficient way. However, if you can get the same optimization with safe “pass by value”, you should use “pass by value”.

暗号通貨短編