The while(...) {...} version. It handles all events while the other will handle 1 per frame... Which'll mess up if you use the mouse or have any other thing that generates a lot of events.
Just be careful you don't ignore all events but the last one to be seen by the while loop or you will end up with dropped events.
ie: deal with all events, or manage the events yourself somehow that makes sense for your application... But don't do the while loop and then process only the last event because you'll have missed all the other ones for the sake of emptying the SDL event queue.
Typically how I handle it is I have at the top of my game loop the sdl event loop (the while loop) which grabs all events, interprets them in some form for my own event manager and then each frame I process events from my event manager as required. Some events are dealt with immediately while others can acceptably be left for a frame or two and so it isn't just a dumb event queue like you get from SDL, though I do maintain order of recieved events when necessary...
Hopefully that explains my view at least... It may not be the best way of handling things, it's just how I do.
_______________________"You're using a screwdriver to nail some glue to a ming vase. " -ToohrVyk
The while loop. When I first started with SDL I read a book that showed the IF method. It caused a lot of slowdown with handling events. Just changing to the while loops sped up the event handling.