Re: [PATCH 35/35] qsort.3: Use sizeof consistently

Michael Kerrisk (man-pages)
2020-09-05T15:36:19Z

On 9/5/20 5:32 PM, Alejandro Colomar wrote:
> On 9/5/20 5:27 PM, Michael Kerrisk (man-pages) wrote:> On 9/5/20 4:20
> PM, Alejandro Colomar wrote:
>>> Use ``sizeof`` consistently through all the examples in the following
>>> way:
>>>
>>> - Use the name of the variable instead of its type as argument for
>>> ``sizeof``.
>>>
>>> Rationale:
>>>
> https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory
>>>
>>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
>>
>> I'm not convinced about this one. Do you really think it
>> improves readability? I kinda feel that it does not.
>
> Well, I have two different ideas for this one.
> In terms of readability, `char *` might seem clearer.
> In terms of preventing bugs, `argv[0]` seems safer.
> For real code I would use the latter. For the man, I have doubts.
>
> Follow your intuition :)

Nothing personal, but I'm rejecting this one :-).

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/