Your program has to be doing something while it's not executing the interrupt code, might as well be a for(...) loop. Otherwise you could have it doing something else useful, or un-useful, like calculating the last digit of pi.
If you really don't have something else to do, and have some aversion to for(...), you might try this, it does the same thing.
main() {
while(1) {
// blah, blah..., whatever code, or completely blank
}
}
"Program never exits" is a signal to the compiler that you have either a for() or a while() loop in main. In this case, the compiler does not have to insert cleanup code after the end of main, like fclose(stdin/out/err), and a variety of other housekeeping chores that are not needed if you have used a for() or while() loop in the main program to prevent it from exiting. It is
not an automatic way to make it not exit.
I don't think there is a 'sleep' or 'idle' mode on Nios, but you would wrap that in a for() or while() loop anyway.