Friday, January 16, 2015

Digest for comp.lang.c++@googlegroups.com - 5 updates in 2 topics

wtholliday@gmail.com: Jan 15 05:45PM -0800

http://www.boost.org/doc/libs/1_57_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
 
Is this as dangerous as it looks? After you lock the weak_ptr to use the object, the object could be destructed and you're left with a dangling shared_ptr.
 
- Taylor
"Öö Tiib" <ootiib@hot.ee>: Jan 16 06:21AM -0800

> http://www.boost.org/doc/libs/1_57_0/libs/smart_ptr/sp_techniques.html#weak_without_shared
 
> Is this as dangerous as it looks?
 
No.
 
> After you lock the weak_ptr to use the object,
> the object could be destructed and you're left with a dangling shared_ptr.
 
You can check in destructor of X that 'this_.use_count() == 1' if you feel worried.
 
When it is not then there is apparent logic defect somewhere and so X may blow
up the application with message suggesting to fix the defect ASAP.
wtholliday@gmail.com: Jan 16 09:07AM -0800

On Friday, January 16, 2015 at 6:21:51 AM UTC-8, Öö Tiib wrote:
 
> You can check in destructor of X that 'this_.use_count() == 1' if you feel worried.
 
> When it is not then there is apparent logic defect somewhere and so X may blow
> up the application with message suggesting to fix the defect ASAP.
 
Good point! Thanks!
Christopher Pisz <nospam@notanaddress.com>: Jan 15 06:57PM -0600

On 1/15/2015 2:25 AM, jacob navia wrote:
> not like or understand. That's why you do not want to discuss here
> anything.
 
> What could you possible say?
 
I've got about 15 years left before I don't care anymore what happens
and what the technology is. I'm no spring chicken, but I am not clinging
to what I did in 1970 either.
 
I already have another generation wanting to talk to me about
reflection, NuGet, class extensions, and other things I haven't had the
pleasure of bringing into my bubble. The difference is that they are
.NET programmers and they program their .NET projects. I am not claiming
my C++ code is .NET, would work in .NET, is more efficient than .NET,
and they aren't claiming anything similar. There is no "C++ is valid
.NET code" argument to be had.
 
I don't go into their projects and litter them with bugs floundering
around without knowing their way of doing things. If I need to go and
edit something, I will gladly go get the 20 something year old developer
and tell him, "I am not sure if this is the right way of doing it or not
in your .NET project, so I wanted you to take a look."
I do not turn to them in arrogance and say things like, "Humph, this
whole reflection business can't be very efficient! I don't think we
should ever use this in our code. Let's instead embed class IDs in every
class we write and make up an encoding system so we can squeeze it into
5 bytes or less. We did that in 1995 and it worked great."
 
http://christopherpisz.ddns.net/Programming/CPlusPlu/WhatIsCSlashCplusPlus.aspx
David Brown <david.brown@hesbynett.no>: Jan 16 10:38AM +0100

On 16/01/15 01:57, Christopher Pisz wrote:
> class we write and make up an encoding system so we can squeeze it into
> 5 bytes or less. We did that in 1995 and it worked great."
 
> http://christopherpisz.ddns.net/Programming/CPlusPlu/WhatIsCSlashCplusPlus.aspx
 
<http://christopherpisz.ddns.net/Programming/CPlusPlus/WhatIsCSlashCplusPlus.aspx>
 
(I haven't read the page yet, but I will do so.)
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: