[Issue 2958] New: std.getopt RangeError on missing arg

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 10 01:19:51 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2958

           Summary: std.getopt RangeError on missing arg
           Product: D
           Version: 2.030
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: unknown at simplemachines.org


Currently, using std.getopt will result in a RangeError if parameters are
improperly omitted on the command line.  Since this is a reasonable user-error,
it does not seem like something to crash on during release.

The problem is here:

            if (!isDelegateWithLessThanTwoParameters && !val && !incremental) {
                // eat the next argument too
                val = args[i];
                args = args[0 .. i] ~ args[i + 1 .. $];
            }

It just needs a check to see if args.length is high enough for this to happen. 
And the documentation should note the exception it throws; currently it says
only a ConvError is thrown.

-[Unknown]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list