   SDL_PollEvent - What's right?
  EVENT LOOP:A professional SDL programmer said to me that's the right way:while(!end){    while(SDL_PollEvent(&event))    {   if(event.type == SDL_QUIT)   {  end = true;   }    }}but I wrote it like this:while(!end){    if(SDL_PollEvent(&event))    {   if(event.type == SDL_QUIT)   {  end = true;   }    }}.Both the first and second works.Whats better? Or Whats wrong? And before all why!?ThanksStromberg.   
  Making an assumption that this is called inside a game loop then one would see the following difference:With "while" vs "if" all messages in the message queue at will be processed each iteration of the game loop.With "if" vs "while" only one event per iteration of the game loop will be processed potentially causing the event queue to get backed up delaying events such as SDL_QUIT from being processed.Hope that helps clear things up.   ;  The first is better, because it deals with all the events. The second one only deals with one event per frame, and if you are generating alot of events (moving the mouse generates alot, for instance) it'll be delayed before you are informed about them.Suppose your game is running at 50 frames per second. Since it's in a if() statement, 'SDL_PollEvent' is only called once per frame. Now, suppose you are moving the mouse around, and pressing some keys, releasing other keys, etc... things that happen alot in games.You could be generating 60-70 events a second, but are only dealing with 50 of them a second (Once per frame, 50 frames a second). The spare events could build up, and players will press a key, and it might be awhile before you actually get the event message.If you have it in a 'while' loop, you deal with all of the events, as soon as you find out you have some waiting.   