POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects : Re: Improved intersection routine for CSG-Intersection objects Server Time
6 Oct 2024 20:23:48 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Warp
Date: 14 Dec 2003 21:44:25
Message: <3fdd2009@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> You clearly haven't done a lot of GUI programming. 

  That's true.

> If you acquire resources
> from the operating system, it is usually a good idea to keep them in a
> specialised container able to release the resource should i.e. an exception
> occur.  Likewise when it comes to passing data to the operating system.
> Frequently this does require a more low-level work on manually allocated
> memory with new, and then auto_ptr can be really helpful! *

  I would try to abstract whatever resources you are allocating from the OS
behind a class. Everything that is related to that resource would be handled
by that class and the public interface would be very abstract. You simply
tell the object "allocate the resources this way" and the object will
handle the system call, storing the pointer or whatever to the allocated
resource and freeing it when appropriate.
  This is more than a "smart pointer". It's a kind of "smart resource
allocator".

  Using a smart pointer sounds more like making system-dependant calls
in wrong places. Like taking system-dependant code higher than necessary
in the abstraction level. The pointer doesn't know what's behind the
pointer, that's left to higher levels to decide. Personally I don't
like that.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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