Re: [PATCH 00/17] man3: SYNOPSIS: Use 'restrict' in prototypes

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

 



Hi Jonathan,

On 3/13/21 5:11 AM, Jonathan Nieder wrote:
Hi,

Alejandro Colomar wrote:

This fixes the remaining pages. With this, all pages have been fixed to use
'restrict'.

Probably the context for this came earlier, but I didn't see it in the
commit message, I figure I should ask:

The origin is here:
<https://lore.kernel.org/linux-man/5a8997be-479b-d813-ce7a-558a8e6633e9@xxxxxx/T/>

And a later (short) discussion about it is here:
<https://lore.kernel.org/linux-man/20210203194354.158439-1-alx.manpages@xxxxxxxxx/T/>


What is the benefit of getting this right for a human reader?  Does
knowing which pointer arguments can't alias help them in tracking down
some bugs, for example?  Or is it going to help them in some other
way?

Yes, I think it will help fixing bugs, or more likely preventing them.
Think for example the case of memcpy(3) (by that time 'restrict' didn't exist), where people would incorrectly use it as if it were memmove(3) ignoring that it could be dangerous (see the NOTES section in memcpy(3)).


Cheers,

Alex

--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



[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