I find that in a function return statement I am able to do this.
int f() {
return 1;;;;;;;;;;;;;;;;;;;;;;;; // ...;;;
}
I can add as many semicolons as I want and the above doesn’t result in any compiler or runtime errors. This surprised me coming from a strict language like C++. Can someone explain why I am able to do this? I’m unable, however, to do this in any other context.
int x = 1;;;; // error
So can someone tell me why I am able to do something like this?
Quoted from K&R, expression statement has product
expression-statement: expression;.It is a valid language construct, so no complains from your compiler.