bill...@gmail.com wrote:
> W dniu środa, 10 grudnia 2014 22:33:35 UTC+1 użytkownik Ian Collins napisał:
>> Kamil Laskowski wrote:
<snip>
>>>
>>> which includes two examples: one with move constructor and one with
>>> copy constructor. I compiled it with VC12 in Debug with disabled
>>> optimization and got only "def ctor copy ctor" for exampleOne and only
>>> "def ctor move ctor" for exampleTwo. It driving me mad because I was
>>> strongly convinced that *temporary* is created after returning from
>>> function fun and from this *temporary* proper object (m in main) is created.
>>>
>>> Could you help me with understanding this?
>>
>> Please wrap your lines!
>>
>> Have a read up on RVO "Return Value Optimisation".
>
> I am sorry for these lenghty lines, but I am not able to edit my
> previous post. BTW, why wrapping is not automatic?
Because the google Usenet interface is horrible... Just add a return
every 70-80 characters.
> Yes, I read and know about RVO but why I am getting this when I
> turned off any optimisation?
Probably because it is part of the language, not a compiler optimisation.
> When I saw the output I felt really concern about
> my knowledge and decided to ask people with more experience. Is there
> any way to compile this without RVO and get desired output?
That's a question for your compiler documentation.
--
Ian Collins