[C++-sig] why does the "shared_ptr<X> const&" silently become 0xCCCCCCCC

ZaeX zaexage at gmail.com
Fri Mar 13 10:13:46 CET 2009


Oh, Thank god, so at least it is not only me. :)

I just double-check this, and this behavior not only happened in debug
build, it will happen in release build too,
But the pointer showing up would not be 0xcccccccc but something arbitrary.

P.S.: I have already changed to follow you guys'  advices to pass by value,
and I will try best to avoid this reference swamp.

On Fri, Mar 13, 2009 at 4:57 PM, athor <thorena at gmail.com> wrote:

>
> I just reproduced the behaviour. Out of habit, I compiled with release the
> last time. Using a debug build, I get the same behaviour (using const&,
> non-const& etc).
>
> I'm guessing this is a case of "undefined behaviour" resulting from mixing
> Debug/Release dll's. Changing to Release (or reading Daves link) should
> help.
>
> Passing shared_ptr by value and not by ref is still recommended though :)
>
> --
> View this message in context:
> http://www.nabble.com/why-does-the-%22shared_ptr%3CX%3E-const-%22-silently-become-0xCCCCCCCC-tp22449314p22492427.html
> Sent from the Python - c++-sig mailing list archive at Nabble.com.
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
Time is mana, we must hurry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20090313/c855ccfe/attachment-0001.htm>


More information about the Cplusplus-sig mailing list