[SDL] Re: Is SDL_GetRGB screwed?????

Dirk-Ulrich Heise hei at adtranzsig.de
Thu Sep 28 00:39:42 PDT 2000


Florian 'Proff' Schulze wrote: 

> *r = (((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 
>              ^^^ 
>If that should be AND and operator, then you just saved some spaces in 
>the wrong place. 
>it should either be: 
>*r = (((pixel & fmt->Rmask) >> fmt->Rshift) << fmt->Rloss); 
>or 
>*r = (((pixel)&(fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss); 
>
>If the & operator is directly before a variable name, then the address 
>of the variable is returned, not the value. 

Utterly wrong, Florian - C doesn't care, the tokenizer spits out
the tokens "pixel","&","fmt" whether they're separated by a 
space or by nothing. It's a whitespace-insensitive language.

Dipl.Inform. Dirk-Ulrich Heise
hei at adtranzsig.de
dheise at debitel.net






More information about the SDL mailing list