BUFSIZ vs magic numbers and co.

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

 



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]

  Powered by Linux