I like while for this type of stuff. This is how I'd usually do it, depending on polarity.
while (!(PORT & MASK)) {};
while(1==1)
Is usually written
while(true)
(but will optimise to the same thing anyway).
for( count=40000; count>0; count=count-1 );
Unless you have a really really slow clock that will be done in an instant. You probably want to insert some delaying function in there, looks like you are targetting an AVR, so ....
https://www.nongnu.org/avr-libc/user-manual/group__util__delay.html (https://www.nongnu.org/avr-libc/user-manual/group__util__delay.html)
Empty loops make me a bit nervous, especially from a readability point of view.
(and see also: https://stackoverflow.com/questions/3592557/optimizing-away-a-while1-in-c0x (which I think is not directly applicable, but adds to the nervousness.)
while (!button);
is particularly bad. "Is that semicolon really supposed to be there?"
Comments are good, like the "// Fall through" comment in case statements.
while (!button) ; /* spin, waiting */
while (!button)
; // spin
while (!button) {
// wait
}
are all better.
And I'll put in a new suggestion
while (1) {
if (button)
break;
}
which I like for indeterminate and long loops. (if you're checking something like a UART status flag, it's a loop that you expect to terminate "soon." Whereas with a button, it could be a very long time indeed. The less likely the event is to occur, the more I like to emphasize the "infinite-ness" of the loop. Or something like that. YMMV, local styles override, etc...)