gcc -V and make -V do *not* print version Per Bothner (15 Feb 2020 07:16 UTC)
Re: gcc -V and make -V do *not* print version Lassi Kortela (15 Feb 2020 08:39 UTC)
Re: gcc -V and make -V do *not* print version Lassi Kortela (15 Feb 2020 08:45 UTC)

Re: gcc -V and make -V do *not* print version Lassi Kortela 15 Feb 2020 08:39 UTC

Thanks for giving feedback.

>       "The Art of Unix Programming, Chapter 10 says:
>      -V: Version (without argument). Display program’s version on
> standard output and exit (often also prints compiled-in configuration
> details as well). Examples:     gcc(1), flex(1), hostname(1), many others."
> This is incorrect, at least in my Fedora machine.  Neither 'gcc' or
> 'make' allow upper-case -V.

You're right. TAOUP is mistaken to give gcc as an example. I'll fix that
in the SRFI.

Uppercase -V doesn't mean anything for gcc and GNU make:

$ make -V
make: invalid option -- V

$ gcc -V
gcc: error: unrecognized command line option '-V'

The book doesn't imply that all (or even most) commands have a -V flag.
Just that it's the closest thing to a standard single-letter version flag.

> Both allow lower-case -v as well as --version.  'clang' likewise.
> 'latex' likewise.

Indeed, --version (with two dashes) is probably most common nowadays.
The TAOUP listing deals only with one-letter flags.

In the survey table
one finds that uppercase -V is actually the _least_ popular option :D

> (Note that gcc -v and gcc --version produce different output, though
> both include the version number.)

Interesting and weird. Probably for historical reasons.

> I don't understand the argument against using --version.  There are some
> programs that
> understand -version but don't understand --version, but if you're going
> to change them to emit
> the LOSE forms you can also change them to understand --version.

The idea is to honor each Scheme's existing long-option syntax (either
one or two dashes) and not require a special-case exception to it.

It would be wonderful if all programs agreed to stick to either the
GNU-style or the X-style long-option syntax and we could use that.
However, there are so many existing programs on each side of the split
(including Scheme implementations) that it will probably never be sorted.

By contrast, one-letter options like -v and -V are as standard as one
can get. There has always been agreement about how they work.

It would be possible to support a "--version" flag as the only argument
even in programs that don't use the GNU-style two-dash syntax, or don't
have any other long options at all (there are small Schemes that don't).
But it's a bit of a hack and requires special-casing the normal option
parser of those implementations.

SRFI 176 used to have language saying "-V is required, but -v and
-version and --version are also allowed". Apparently it got lost in
editing at some point :-/