pragma boundschecking

  1. 2 weeks ago

    Thomas S

    is not verified Nov 28 Pre-Release Testers, Xojo Pro

    Xojo 2019r2 / Win 10

    Why does following code throw a OutOfBoundsException, instead of hard crash?

    dim i() as integer
    
    #pragma boundschecking false
    
    dim x as integer = i(0)
  2. Christian S

    Nov 28 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    I assume this calls an array getter function, which does the bound check always.

    The pragma can only work if the Xojo compiler inlines the lookup via pointer operations.

  3. Thomas S

    is not verified Nov 28 Pre-Release Testers, Xojo Pro

    Does that mean that #pragma boundschecking false never makes any difference?

  4. Christian S

    Nov 28 Pre-Release Testers, Xojo Pro, XDC Speakers, Third Party Store Germany

    you may need to ask someone from Xojo Inc. who can look into the compiler.

  5. Christoph D

    Nov 28 Pre-Release Testers, Xojo Pro

    What happens when you put the pragma as the first line?

  6. Kevin G

    Nov 28 Pre-Release Testers, Xojo Pro Gatesheed, England

    I'm pretty sure I was told by one of the Joes that this is basically a no-op now.

    A few years ago we moved some code from RB to Xojo. The RB version worked fine but the Xojo version triggered an OutOfBoundsException. It turned out the RB version should have triggered the exception but was being masked by the pragma and by chance wasn't crashing altogether.

  7. Thomas S

    is not verified Nov 29 Pre-Release Testers, Xojo Pro

    I'm pretty sure I was told by one of the Joes that this is basically a no-op now.

    Ah ok - that makes sense.

or Sign Up to reply!