stimmer:
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 but have you ever intentionally written for(LinkedList * ptr=head; ptr->next; ptr=ptr->next); and then immediately followed it with a { ?
As far as I know there is no GCC warning for this kind of mistake anyway.
Can't say as I have, no, however there is no syntactical reason why that would be wrong.
There is nothing to say that a { HAS to follow a for/while/if etc - it can just be on its own. You can use it to group blocks of code to make it easier to read. I don't know anyone that actually does that, but it's perfectly valid.