majenko:
Any decent C++ compiler will warn about that stray semicolon, but unfortunately the Arduino IDE turns most of the gcc compiler warnings off.
Why? That's a perfectly valid thing to do, and I do it often. Especially when traversing to the end of a linked list:
for(ptr=head; ptr->next; ptr=ptr->next);
ptr->next = newelement;
Yes, it's valid C++, but convention is that if you really want to write a loop with an empty body, you indicate that it is intentional, either by using { }, or by putting a newline or a comment between the ) and the ; .