[bug?] behavior of if (condition);

 

Hi,

I made a simple mistake to write unknowingly a ";" after an if condition,
it took me a lot of time to realize that mql5 permits it, and considers it valid

if (0);
    printf("stuff");  //will get printed, because the ";" above

It should appear as an error in code,
I don't see any potential use of permitting a ";" after the if condition

I don't know if it's a bug though, I don't know if c++ accepts it or not
But I thought it would be well to write this issue at least, here

 

I tried c++ on www.repl.it

and it throws a warning:

 clang++-7 -pthread -std=c++17 -o main main.cpp
main.cpp:6:11: warning: if statement has empty body
      [-Wempty-body]
    if (0);
          ^
main.cpp:6:11: note: put the semicolon on a separate line to
      silence this warning
1 warning generated.
 ./main
Hello, world! 


after searching closely into the messages of the mql5 compiler,
such a warning is there too, but it's lost in the maze of lots of "declaration" warnings

(it would be super cool if we could check / uncheck what warnings to see or hide

 
if (0){};
    printf("stuff");  //will get printed, because the ";" above

It differs from this

if (0){
       printf("stuff");  
      };
Reason: