Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Does Burst support the unchecked keyword?

Discussion in 'Burst' started by TheOtherMonarch, Oct 15, 2019.

  1. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    862
  2. sheredom

    sheredom

    Unity Technologies

    Joined:
    Jul 15, 2019
    Posts:
    300
    The answer is - kind of.

    By default in Burst our integer math is unchecked - we do not throw exceptions on integer overflow/underflow.

    If you use an unchecked statement, the compiler will treat this as a no-op, because the underlying math is assumed to be unchecked.

    If you use a checked statement - we currently ignore the overflow check too, but its on our todo list to make it throw an exception on checked code.