POV-Ray : Newsgroups : povray.general : CSDL: C-like Simulation Description Language : Re: CSDL alpha 1 release Server Time
7 Aug 2024 09:21:03 EDT (-0400)
  Re: CSDL alpha 1 release  
From: Christopher James Huff
Date: 23 Jan 2002 18:08:50
Message: <chrishuff-2A99E7.18095223012002@netplex.aussie.org>
In article <3c4f3723@news.povray.org>,
 "Thorsten Froehlich" <tho### [at] trfde> wrote:

> And you don't need to duplicate any code at all.  Simply make your copy
> function virtual.  That way by default the copy function of the subclass
> will be called.  In that function simply write "return new SubClass(*this);"
> and all your problems are gone.

That's what I do, that was the duplicate code I was talking about...I 
just get tired typing that stupid one-liner in every time, when a 
subclass only needs to change one method.


> > Having to return void pointers and cast them to the
> > correct types. Mostly having what I can do with an object being
> > determined by the type of pointer to it I have, instead of what the
> > object can do.
> Hmm, this really should not happen. 

Yeah, I can get around it, but the code's not really any better. I'm 
going to redesign that portion of the code to use templates and get rid 
of the void pointers for the next alpha...


> Well, keep in mind that the most powerful feature of templates, the "export"
> keyword is not supported in any compiler yet.  Once it will be available
> templates have a potential far greater than what i.e. Java offers for
> reusable containers.  Basically the export keyword has the power to
> completely delegate the choice of code reuse to the compiler.  Current
> compilers will duplicate a lot of similar code, and some will then hope for
> the linker to cleanup the mess.  Of course, this way a lot of potential
> using the available information for optimization is lost :-(

I'm not sure quite what you mean...though if no compilers support it 
yet, I guess it doesn't really matter.

-- 
 -- 
Christopher James Huff <chr### [at] maccom>


Post a reply to this message

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