Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-15 Thread Paul Eggert
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 ma

Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-15 Thread Bruno Haible
Hi Paul, > My confusion arose partly because I am accustomed to languages where the > distinction between null and non-null pointers is checked statically and > reliably, and I keep forgetting that with C, GCC and Clang are only poor > approximations to that Oh, now I understand. May I guess t

Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-14 Thread Paul Eggert
On 2023-01-14 03:00, Bruno Haible wrote: Is that what you are worried about? Should I work on this? No, please don't bother. I was partly confused by the situation and your email helped clear up some of it. Hope you don't mind this followup. My confusion arose partly because I am accustomed

Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-14 Thread Bruno Haible
Paul Eggert wrote: > > ... starts with an entry check — which is a good practice [1] > > It's a good practice in some contexts, bad in others. It's a good practice at least when - the function is non-static (and therefore the callers are not all known), - checking the parameters is fast, -

Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-13 Thread Paul Eggert
On 2023-01-13 14:59, Bruno Haible wrote: Replacing a function that starts with an entry check — which is a good practice [1] It's a good practice in some contexts, bad in others. In this particular case, on practical Gnulib targets the input should be checked anyway, both statically by the co

Re: [PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-13 Thread Bruno Haible
Paul Eggert wrote: > Problem found by xlclang 16.1 on AIX 7.2. > * lib/localename.c (duplocale, freelocale): > Omit unnecessary comparison of non-null args to NULL. I disagree with this patch. Compiler warnings are supposed to help us improve the code. Replacing a function that starts with an en

[PATCH 1/4] localename: -Wtautological-pointer-compare

2023-01-13 Thread Paul Eggert
Problem found by xlclang 16.1 on AIX 7.2. * lib/localename.c (duplocale, freelocale): Omit unnecessary comparison of non-null args to NULL. --- ChangeLog| 7 +++ lib/localename.c | 6 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2485