groff
[Top][All Lists]
Advanced

[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, 2 Aug 2022 13:38:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.0

Hi Doug,

On 7/27/22 15:23, Douglas McIlroy wrote:

Incidentally, I personally don't use NULL. Why, when C provides a
crisp notation, 0, should one want to haul in an extra include file to
activate a shouty version of it?


Because I don't know what foo(a, b, 0, 0) is, and I don't know from memory the position of all parameters to the functions I use (and checking them every time would be cumbersome, although I normally do, just because it's easier to just check, but I don't feel forced to do it so it's nicer).

Was the third parameter to foo() the pointer and the fourth a length, or was it the other way around? bcopy(3) vs memcpy(3) come to mind, although of course no-one would memcpy(dest, NULL, 0) with hardcoded 0s in their Right Mind (tm) (although another story is to call memcpy(dest, src, len) with src and len both 0).

Knowing with 100% certainty that something is a pointer or an integer just by reading the code and not having to go to the definition somewhere far from it, improves readability.

Even with a program[1] that finds the definitions in a big tree of code, it would be nice if one wouldn't need to do it so often. Kind of the argument that some use to object to my separation of man3type pages, but for C code.

[1]: grepc(1) <http://www.alejandro-colomar.es/src/alx/alx/grepc.git/>

Cheers,

Alex

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

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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