BUFSIZ vs magic numbers and co.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: "Michael Kerrisk (man-pages)" <mtk.manpages@xxxxxxxxx>
- Subject: BUFSIZ vs magic numbers and co.
- From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>
- Date: Mon, 7 Sep 2020 23:37:49 +0200
- Cc: linux-man <linux-man@xxxxxxxxxxxxxxx>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0
Hi Michael,
There are a lot of EXAMPLES where buffers are created. In those
examples, usually there is either a magic random number (e.g., 100, 500,
1000) or a custom macro such as `#define BUF_SIZE 500`.
Those examples could all use `BUFSIZ` from <stdio.h>, which would reduce
code (not having to define the macro), and be more consistent (not
having a random magic number in each example).
However, I see a slightly good point in having magic numbers in the
examples section: a novice reader could infer that you are focrced to
use BUFSIZ if it's written all over the place, while if there is a
random magic number, the reader probably will deduce that he can use any
number.
What do you think about it? Would it be better to consistently use
BUFSIZ, or just keep the magic numbers?
Regards,
Alex.
[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]