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

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

 



Hi Jakub,

On 7/25/22 20:57, Jakub Wilk wrote:
* Alejandro Colomar <alx.manpages@xxxxxxxxx>, 2022-07-24, 21:19:
+.B "#define NULL  ((void *) 0)"
+.fi
+.SH DESCRIPTION
+.B NULL
+represents a null pointer constant.
+.PP
+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.

+.SH CONFORMING TO
+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).


+.I NULL \- NULL
+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.


Cheers,

Alex

--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux