[SDL] SDL_SetColorKey() Doc suggestion

Mattias Engdegård f91-men at nada.kth.se
Fri Apr 27 12:10:24 PDT 2001


In article <9b50l9$oi4$1 at ftp.lokigames.com>, "Olivier Dagenais"
<olivier.dagenais at canada.com> wrote:

>> > When working with Semaphore, if you get an error when calling
>> > SDL_SemWait() or SDL_SemPost(), what could this indicate? Should I
>> > handle it gracefully with an 'if' statement, or is simply
> an
>> > assert, good enough? I was thinking of speed you see, when I'm
> sure it
>> > all runs well with no Semaphore errors, I could just add -DNDEBUG,
> to
>> > skip all the semaphore checks.
>> I've never seen an error with the semaphore operations.  Have you? I
>> think an assert would be fine.
> 
> Agreed.  I looked at the source for Win32 and it's unclear (in MSDN) why
> WaitForSingleObject would fail, except if the handle to the semaphore
> was invalid (ie: you forgot to call SDL_CreateSemaphore or you somehow
> overwrote the memory of your struct).  I imagine it would be similar on
> other platforms.

And since errors like that should be ironed out in debugging, assert will
do. :) 
That'll elliminate a shit load of 'if's', that are called constantly. 

Defensive programming is best, but you got to draw a line somewhere when
you want to write games that go like the clappers. 

Arthur.






More information about the SDL mailing list