Op 24-04-2025 om 13:24 schreef Nathan Sharp:
If it is to be done at all, it MUST be done inside the usage() function; so that it is unlikely that future changes will introduce a read of an uninitialized global variable.
Which variable would be uninitialized? Global variable 'opt_size' gets initialized to -1 in the beginning. But okay, moving the two lines before the call of usage() to the start of usage() itself is fine.
However, I do not think this is a good idea in isolation, as it deprives the user of the knowledge of where the default size comes from,
Not at all: where the value comes from is mentioned in the man page. The usage text is not meant to include _all_ details about the program -- that is what the man page is for. And, unlike the man page, the usage text _can_ include the actual value of the thing. And if it can, it should, in my opinion, as the value itself is much more useful than saying "go look there".
and additionally could cause the help message to print a warning!
That is actually better than referring to a file that happens to be unreadable/unparsable, because then the help text would be lying. Benno
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature