POV-Ray : Newsgroups : povray.off-topic : OO theory? Python. : Re: OO theory? Python. Server Time
28 Jul 2024 22:26:45 EDT (-0400)
  Re: OO theory? Python.  
From: Warp
Date: 13 Oct 2012 14:38:06
Message: <5079b50e@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:
>   Vector & operator +(const Vector &v2) const
>   {
>      return Vector(
> this.internal_storage[0]+v2.internal_storage[0],
> this.internal_storage[1]+v2.internal_storage[1],
> this.internal_storage[2]+v2.internal_storage[2] );
>   }

You are returning a reference to a temporary. Kaboom.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.