1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Bug? Missuse of the Exit keword not traped

Discussion in 'B4R Bugs & Wishlist' started by ivan.tellez, Jul 15, 2019.

  1. ivan.tellez

    ivan.tellez Active Member Licensed User

    I accidentally write

    Code:
    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?
     
  2. Erel

    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.
     
  3. ivan.tellez

    ivan.tellez Active Member Licensed User

    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    The cursor should jump to the relevant line.

    You posted it as a bug report. My answer is that it is not considered a bug.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice