Re:The Itanic Has Sunk
by jonathrg on Friday July 30, 2021 @08:25AM
(#28007197)
What? I use it whenever I have a function that takes two or more pointers if I know they can't refer to overlapping memory. And it's part of the signature for memcpy since C99
[ Parent
| on HN ]
When he said "anyone" he meant "almost anyone". You're an outlier if you use `restrict` regularly.
I checked on grep.app, there are 10k results for `restrict` for C code, compared to 700k for `struct` (I know they're not directly comparable but that gives an idea.
That seems like about the right proportion to me - struct solves a much more common problem than restrict does. And to be fair, it is a lesser known feature. But user-the-name is implying that restrict is somehow difficult to use or understand, which I don't agree with at all.
That probably explains it. In many shops, C may as well have stopped at C89.
I've been working with C since the early 90's. I've never seen any code use restrict.
Re:The Itanic Has Sunk
by enjoy-your-stay on Friday July 30, 2021 @05:22PM
(#28012530)
Also large chunks of libc use it as well, e.g. the printf family of functions.