IDE allows double semi-colon

Hi Particles,
Has anyone else noticed (and I’m sure I’ll get a flood of see xxx post here) that the IDE allows you to include two semicolons at he end of a line of code? It also somehow allows this to be uploaded to an unsuspecting Photon, which I discovered at the loss of nearly a day will absolutely screw up any application.


A semicolon in C/C++ is null statement, that is, a statement that doesn’t do anything. This is actually sometimes useful in switch statements but is usually just a benign thing–it can’t hurt you. There are also a few places in C++ where you should not use a semicolon. So with a few C++ caveats, two semicolons is perfectly legal and should be benign.

I can believe that it might hurt you if the pre-processor does something weird with it, but not in a class or when the preprocessor is off.


Thanks for the tip BKO - I’m a newbie. I sort of realised it may be a legal C++ statement. I tried it in the Arduino IDE and no error occurred there either. Trap for beginners, but we only learn by mistakes - or by actually doing our homework, which I didn’t.