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

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

 



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@xxxxxxxxx>

I'm not convinced about this one. Do you really think it
improves readability? I kinda feel that it does not.

Thanks,

Michael

> ---
>  man3/qsort.3 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man3/qsort.3 b/man3/qsort.3
> index b49c2a9d3..e1af43cf0 100644
> --- a/man3/qsort.3
> +++ b/man3/qsort.3
> @@ -150,7 +150,7 @@ main(int argc, char *argv[])
>          exit(EXIT_FAILURE);
>      }
>  
> -    qsort(&argv[1], argc \- 1, sizeof(char *), cmpstringp);
> +    qsort(&argv[1], argc \- 1, sizeof(argv[0]), cmpstringp);
>  
>      for (j = 1; j < argc; j++)
>          puts(argv[j]);
> 


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



[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