Re: Pointer subtraction with a null pointer - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: Pointer subtraction with a null pointer
Date
Msg-id CAMsGm5ck5rfhE=MU+frgdEfUL8pHZBkkP=bBHXuHZzDXTcF_2w@mail.gmail.com
Whole thread Raw
In response to Re: Pointer subtraction with a null pointer  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Sat, 26 Mar 2022 at 12:24, Andres Freund <andres@anarazel.de> wrote:
 
NULL can never be part of the same "array object" or one past past the last
element as the pointer it is subtracted from. Hence the undefined beaviour.

Even more fundamentally, NULL is not 0 in any ordinary mathematical sense, even though it can be written 0 in source code and is often (but not always) represented in memory as an all-0s bit pattern. I'm not at all surprised to learn that arithmetic involving NULL is undefined.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Pointer subtraction with a null pointer
Next
From: Andres Freund
Date:
Subject: Re: Pointer subtraction with a null pointer