std.getopt suggestion

Jonathan M Davis jmdavisProg at gmx.com
Wed Oct 5 08:14:53 PDT 2011


On Wednesday, October 05, 2011 16:24:32 Jens Mueller wrote:
> > However, the current way to parametrise getopt is to change the
> > character for options ('-'), and I belive the string for long option is
> > twice the character for short option ("--"). I don't think this makes
> > great sense. We could parametrize a long option string (that we could
> > set to "-"), and a short option char (that may or may not be
> > automatically set to longOptionString[0]). But no parametrization on the
> > shortOptionChar and on the longOptionString is fine too. Nobody would
> > complain the call to getopt could be screwed up by another programmer
> > modifiying the shortOptionChar behind your back if this could not be
> > changed in the first place...
> 
> This can be implemented. But right now I'm trying to figure out whether
> it's worth it.

Personally, I think that the usage of a single dash with long options is the 
sort of thing that should be discouraged in programs, since it goes against 
how posix programs normally work.

- Jonathan M Davis


More information about the Digitalmars-d mailing list