POV-Ray : Newsgroups : povray.advanced-users : Object Oriented POV code : Re: Object Oriented POV code Server Time
29 Jul 2024 14:13:02 EDT (-0400)
  Re: Object Oriented POV code  
From: Christopher James Huff
Date: 21 Feb 2004 22:26:17
Message: <cjameshuff-FA7CA8.22265921022004@news.povray.org>
In article <403814c4$1@news.povray.org>, "Tek" <tek### [at] evilsuperbraincom> 
wrote:

> Well, I know a good argument against it. So good in fact that it's the reason
> why every games programmer I know doesn't use operator overloading: It hides
> processing.

So do functions.


> i.e. when you compile a+b, you expect it to compile to a simple add 
> instruction,

If I'm adding things that the processor can add.


> and these days most processors can do vector maths so I'd certainly support 
> it being used for them.

And that could be done, as well.


> The problem is if you've defined your own type of data that has a "+" 
> function, you incur the cost of a function call invisibly in your 
> code.

No I don't. I'd have to call that function anyway, so there is precisely 
zero overhead. Even if I was wrapping numeric types that the processor 
could work on directly, the compiler would inline the code, getting rid 
of the function call.


> Of course, for less speed critical stuff like describing POV scenes, I'd
> wholeheartedly support it. But I'm just saying there *is* a good argument
> against it.

I still haven't heard one yet.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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