Re: [PATCH] cmd/mem.c: fix undefined behavior in mem cmp

2024-10-14 Thread Quentin Schulz
Hi Rasmus, On 9/30/24 11:54 AM, Rasmus Villemoes wrote: Quentin Schulz writes: Hi Rasmus, On 9/27/24 8:56 PM, Rasmus Villemoes wrote: Quentin Schulz writes: From: Quentin Schulz My linter complains that "When using void pointers in calculations, the behaviour is undefined". GCC does s

Re: [PATCH] cmd/mem.c: fix undefined behavior in mem cmp

2024-09-30 Thread Rasmus Villemoes
Quentin Schulz writes: > Hi Rasmus, > > On 9/27/24 8:56 PM, Rasmus Villemoes wrote: >> Quentin Schulz writes: >> >>> From: Quentin Schulz >>> >>> My linter complains that "When using void pointers in calculations, the >>> behaviour is undefined". >>> >>> GCC does say that "In GNU C, addition a

Re: [PATCH] cmd/mem.c: fix undefined behavior in mem cmp

2024-09-30 Thread Quentin Schulz
Hi Rasmus, On 9/27/24 8:56 PM, Rasmus Villemoes wrote: Quentin Schulz writes: From: Quentin Schulz My linter complains that "When using void pointers in calculations, the behaviour is undefined". GCC does say that "In GNU C, addition and subtraction operations are supported on pointers to

Re: [PATCH] cmd/mem.c: fix undefined behavior in mem cmp

2024-09-27 Thread Rasmus Villemoes
Quentin Schulz writes: > From: Quentin Schulz > > My linter complains that "When using void pointers in calculations, the > behaviour is undefined". > > GCC does say that "In GNU C, addition and subtraction operations are > supported on pointers to void"[1] but this hints at this only being > su

[PATCH] cmd/mem.c: fix undefined behavior in mem cmp

2024-09-27 Thread Quentin Schulz
From: Quentin Schulz My linter complains that "When using void pointers in calculations, the behaviour is undefined". GCC does say that "In GNU C, addition and subtraction operations are supported on pointers to void"[1] but this hints at this only being supported in the GNU flavor of C. And I a