|
From: | Paul Eggert |
Subject: | Re: [PATCH 1/4] localename: -Wtautological-pointer-compare |
Date: | Sun, 15 Jan 2023 16:15:04 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
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.
[Prev in Thread] | Current Thread | [Next in Thread] |