We just found, a colleague and I, a strange compiling syntax with the If conditional syntax :
if (true); {
foo();
}
Is there someone here for explaining to us this strange syntax? Thx.
to me, it looks like an if statement with an empty body, followed by a code block that always executes (and is unrelated to the if statement). For example, does foo also execute here:
if (false); {
foo();
}
The first part, if (true);
is just a do-nothing conditional that ends at the ;
. The rest is a call to foo()
inside a new scope block. You should find that foo()
is always called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With