POV-Ray : Newsgroups : povray.off-topic : Games programmers : Re: Games programmers Server Time
10 Oct 2024 11:22:10 EDT (-0400)
  Re: Games programmers  
From: Orchid XP v8
Date: 11 Sep 2008 16:46:13
Message: <48c98395@news.povray.org>
Warp wrote:

>   The basic design principle in C++ is that you don't have to pay for
> what you don't use.
> 
>   C++ supports dynamic binding if you need it, but it's not shoved down
> your throat by force.

I prefer the Eiffel way, where the compiler looks at your program and 
automatically decides which things can be bound statically (with all the 
optimisations that follow), and which things actually require dynamic 
binding.

(Actually, Haskell does something similar - but Haskell is so un-OO that 
that's a fairly bad comparison.)

But I guess having to do it manually isn't so hard.

>>>> Templates?
>>>   One of the coolest, most powerful and most useful things around.
> 
>> And also one of the hardest parts to learn, no doubt.
> 
>   What's so hard to learn about them?

I don't know - I haven't tried yet. ;-)

> Usually the only difference is
> that theres one or more type which are abstracted away, and that's it.
> For example, rather than writing:
> 
> int foo(int parameter) { ... }
> 
> where the type of the parameter and the return value is fixed to int,
> you abstract them away like this:
> 
> template<typename Data_t>
> Data_t foo(Data_t parameter) { ... }
> 
>   Now you can call that function with ints, longs, doubles, chars...

So that basically means the same thing as Haskell's

   foo :: x -> x
   foo = ...

then?

Does it actually build a seperate copy of the function for each data 
type, or just build one generic version that works with all of them?

>   Sure, when you start developing really complicated template code, you
> can get quite obfuscated templates, but that's usually more the exception
> than the rule.

Well, yeah, that goes for any language feature... ;-)

>> The "maybe you should use some other language" part pretty much hits the 
>> mark, IMHO.
> 
>   Sometimes you have to use what the industry demands, not what you would
> like to use.

Ain't that the truth! ;-)

> Besides, it's not that bad.

Well, I guess not. I could have people forcing me to write Bash 
scripts... >_<

>   Yes, debug checks are nice. They are nicer if you can turn them off
> for a final release.

There is certainly something to be said for that.

The problem is that, certainly with C anyway, there's no switch to turn 
it ON in the first place. :-(

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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