This is the example given on the wiki and the way every tutorial I've seen does it...
while (1) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
/* handle your event here */
}
/* do some other stuff here -- draw your app, etc. */
}
If I have this kind of event loop within an update function within my game loop, am I wrong in thinking the program is re-defining and re-allocating a place for a new event struct every iteration of the loop? And am I wrong in thinking that's a inefficient way of doing it? Can't the event struct be defined once elsewhere and filled with different events throughout the life of the program without needing totally redefined every iteration of the update function? And if so where would I want the event struct to be defined? Globally within my game or main source file or what?
What would be the benefit, if any, of having the event allocated on heap?