[Semi OT] Language for Game Development talk

via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 26 02:24:18 PDT 2014


On Friday, 26 September 2014 at 08:59:04 UTC, po wrote:
>> - RAII makes most sense if you have exceptions.
>   RAII is orthogonal to exceptions, so his claim is nonsense.

Just a note: this isn't really true. RAII was initially used to 
deal with exceptions. If you want fast backtracking and just 
reset the stack pointer (rather than unwinding) then 
stack-allocated RAII objects won't work since they will be 
overwritten. You need to maintain a list of "destructors" in 
thread local memory or close to the stack root so that you can 
close files etc. Whether RAII is the best option really depends 
on what kind of execution patterns and performance 
characteristics you are aiming for.


More information about the Digitalmars-d mailing list