Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Program Options: Just curiosity, why double dashes ?
From: Mika Heiskanen (mika.heiskanen_at_[hidden])
Date: 2009-11-27 16:03:52


Mauricio Gomes wrote:
> I am studying Boost Program Options library and I am curious, why was it
> choosen double dashes as the token to identify an option in the command
> line ?
>
> Example:
> my_program --help
>
> Would not a single dash be enough and less verbose ?
> What is the rationale behind that ?

POSIX recommends that

   a) options are preceded by a single dash
   b) that multiple options may follow the dash
   c) the options may come in any order

In particular this implies the following would be equivalent:

  -h -e -l -p
  -help

If one wishes to use long option names with a single dash only, one may
encounter conflicts in determining what the option string means if some
combination of one-letter options matches a long name of a particular option.
Hence GNU then extended the POSIX conventions by requiring long option names
to be preceded by two dashes.

--> Mika Heiskanen


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net