- 论坛徽章:
- 0
|
because the gcc use the NRVO option to optimaze the codes for improving the performance, but the MS Studio doesn't use the NRVO;
The Visual C++ 8.0 compiler makes use of the flexibility that the standard provides and adds a new feature: Named Return Value Optimization (NRVO). NRVO eliminates the copy constructor and destructor of a stack-based return value. This optimizes out the redundant copy constructor and destructor calls and thus improves overall performance. It is to be noted that this could lead to different behavior between optimized and non-optimized programs (see the Optimization Side Effects section). |
|