Please explain this line :)

Hello,

I am hoping someone can help me, I have just started on SDL (but this is a C++ not SDL question). The tutorial has this line

if((Surf_Display = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF)) == NULL)

(I am not concerned with what the functions do)

I have two issues, firstly I am a bit confused by the if statement itself. I have tried to google it and people also seem to say that initialization is not a bool, so what is going on here?

Secondly could somebody please tell me the name of the | "operator" in the parameter list. I think I across it once before and I want to google what it means, but I can't remember what it is called and it is hard to google.

Thanks! :D
It sets Surf_Display to what ever the function returns and tests if it is NULL. '|' is a pipe character which is a logical bitwise OR.
Edit: Confused terminology, "||" is logical OR.
Last edited on
It's bitwise or. Logical or is ||.
Thanks for your help! Yeah the first part is so obvious now, feel a little silly!

And yes of course bitwise OR! This is definitely a sign I should call it a night and go to bed :)

Thanks again people!
Topic archived. No new replies allowed.