[SDL] Const correctness for SDL video

David Olofson david at olofson.net
Wed Feb 14 12:37:26 PST 2007


On Wednesday 14 February 2007 21:25, Ken Rogoway wrote:
> 
> If you use:
> 
>  
> 
> If ( 0 = rect.h )
> 
>  
> 
> You will get a compiler error since you cannot assign rect.h to the
> constant 0.

I used to do that, but not even that makes much sense these days. Any 
serious compiler should be able to give you a warning if you do:
	if ( x = y )

rather than:
	if ( x == y )

(To actually do the first operation, you do this:
	if ( (x = y) )

to tell the compiler that you actually mean that. At least that's how 
it works with GNU gcc.)


//David Olofson - Programmer, Composer, Open Source Advocate

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'


More information about the SDL mailing list