[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3] NULL.3const: Add documentation for NULL

From: Alejandro Colomar
Subject: Re: [PATCH v3] NULL.3const: Add documentation for NULL
Date: Tue, 26 Jul 2022 14:36:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2

Hi Jakub,

On 7/25/22 20:57, Jakub Wilk wrote:
* Alejandro Colomar <>, 2022-07-24, 21:19:
+.B "#define NULLĀ  ((void *) 0)"
+represents a null pointer constant.
+According to POSIX,
+it shall expand to an integer constant expression with the value
+.B 0
+cast to type
+.IR "void *" .

Might be worth noting that the cast requirement was added only in POSIX.1-2008 aka SUSv4.

+C99 and later;

It's in C89 too.

Michael and I agreed that for new pages, we're going to ignore the C89 standard, as almost all current code assumes C99 is available, at least to a certain degree of support.

The same as POSIX.1-1990 is also ignored for simplicity, and we start counting from POSIX.1-2001.

I'm not sure if documenting C89 provides any value (apart from historical curiosity, that is).

+is, surprisingly, undefined behavior, according to ISO C.

FWIW, I don't find it surprising at all.

Then you might perhaps find it surprising that in C++ it's defined to be 0.



Alejandro Colomar

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]