On 2023-01-15 14:03, Bruno Haible wrote:
My confusion arose partly because I am accustomed to languages where the
distinction between null and non-null pointers is checked statically ...
Oh, now I understand. May I guess the language: Haskell, OCaml, TypeScript,
Rust?
These days OCaml and maybe Rust, though the language that first comes to
my mind is one I designed in the 1970s and never got off the ground: B
Pascal.
Unfortunately, this is an excellent example for a portability problem:
The division yields a SIGFPE on x86, x86_64, alpha, m68k, and s390/s390x
CPU, but not on other architectures.
I suppose I should have written that my assumption was that the code is
executed in a context where the divisor must be positive. (This is
pretty common when calculating indexes from sizes.)
In other contexts the extra checking may be necessary, or at least helpful.