1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-17 11:28:55 +00:00
millfork/doc/abi/undefined-behaviour.md
2018-01-04 01:15:04 +01:00

1.0 KiB

Undefined behaviour

Since Millfork is only a middle-level programming language and attempts to eschew runtime checks in favour of performance, there are many situation when the program may not behave as expected. In the following list, "undefined value" means an arbitrary value that cannot be relied upon, and "undefined behaviour" means arbitrary and unpredictable behaviour that may lead to anything, even up to hardware damage.

  • array overruns: indexing past the end of an array leads to undefined behaviour

  • stray pointers: indexing a pointer that doesn't point to a valid object or indexing it past the end of the pointed object leads to undefined behaviour

  • reading uninitialized variables: will return undefined values

  • stack overflow: exhausting the hardware stack due to excess recursion, excess function calls or excess stack-allocated variables

  • violating the safe assembly rules

  • violating the safe reentrancy rules

The above list is not exhaustive.