Bug? Missuse of the Exit keword not traped

ivan.tellez

Active Member
Licensed User
I accidentally write

B4X:
If State = True Then Exit
And I get an error in the C++ code:

b4r_main.cpp:287:11: error: break statement not within loop or switch
if (true) break;};


I had another, more complex if just afther that line, so, I tried to fix that one :(. Until I realized that I must have used return.

Shouldn't the B4X compiler catch this error (Detect that there is no current loop to exit) before it creates the C++ code?
 

Erel

Administrator
Staff member
Licensed User
This is not considered a bug. The B4R compiler will not catch all errors. Note that the IDE shows you the error line when such errors occur.
 

ivan.tellez

Active Member
Licensed User
This is not considered a bug. The B4R compiler will not catch all errors. Note that the IDE shows you the error line when such errors occur.
Maybe Im missing something, but I cant see the error line of the B4R code. The error and line, are from the C++ code. How can I see what line of the B4R code was the bug in?

Is not posible to have a warning (or better an error), like the one of the variable i in the picture? "Exit statement not within loop or switch."

upload_2019-7-16_10-31-31.png
 
Top