[Semi OT] Language for Game Development talk
po via Digitalmars-d
digitalmars-d at puremagic.com
Fri Sep 26 00:24:47 PDT 2014
> std::string tends to be more complicated because of the small
> string optimization. Most debuggers I've used don't handle
> that correctly out of the box, even if sorting it out really
> isn't difficult.
Almost all game developers use Visual Studio, and VS has
supported visualization of all STL containers(including string)
since VS2005.
>This is really missing the point. He knows RAII is useful and he
>knows RAII solves freeing free'd memory. Maybe it's time to
>re-watch the video.
I watched it. None of what he said made much sense.
His claims:
1. RAII is bad because exceptions.
-Nothing forces to use exceptions, so irrelevant
2. RAII is bad because you must write copy constructor,destructor
etc each time.
-No you write a few basic template classes and reuse them.
>Regarding exceptions, they can be used incorrectly, but I think
>they tend to provide better error handling than return codes
>*because no one ever checks return codes*. And when you do
>pathologically handle error codes, the amount of code
>duplication can be tremendous, and the chance for errors
>involving improper cleanup can be quite high. Though again,
>RAII can be of incredible use here.
That is all true, I agree that exceptions are better than error
codes.
But for games, the general design is that errors are impossible.
The game should never fail so exceptions serve little purpose.
-ran out of memory? Shut game down, this should not happen
-couldn't open a file? Shut game down, this should never happen
-out of bounds array access, invalid iterator etc: abort game,
found during development, fixed, should never happen.
-networking? This is one place where you do need to handle
errors, but do you need exceptions just to handle this one case?
Probably not
More information about the Digitalmars-d
mailing list