Opened 13 years ago

Closed 13 years ago

#418 closed defect (fixed)

OptionArg<double> doesnt allow negative numbers

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.5
Component: utility Version: 0.4.1
Keywords: Cc:

Description (last modified by Peter)

needed for ticket:413

I get the following error:

./psd --min-temp="-60"
psd: : invalid option -- 6
Try `psd --help' for more information.

I've tried

./psd --min-temp=-60
./psd --min-temp -60

and they all give the same error.

Change History (5)

comment:1 Changed 13 years ago by Peter

(In [1431]) refs #418 - added a test for this bug. The test is not active in the sense it does not affect the retunred value, but in verbose mode there is some output.

comment:2 Changed 13 years ago by Peter

The problem is that Option::parse is taking arguments by value. In end of parse in OptionArg? there is a call ++first, but this has no effect outside in CommandLine so iterator pointing to current parameter is then pointing to "-6" and there is no such option. If replacing "-6" with "6", the "6" is detected not to be an option (since it doesn't start with '-') and that element is just ignored (see ticket:413). This also implies that if ticket:413 is implemented (the "6" is not ignored) this will cause a problem, so it probably better to fix this first.

I was hoping to fix this within 0.4 but I'll give up since it is more or less impossible without changing the interface.

comment:3 Changed 13 years ago by Peter

Description: modified (diff)
Milestone: yat 0.x+yat 0.5

comment:4 Changed 13 years ago by Peter

Status: newassigned

comment:5 Changed 13 years ago by Peter

Resolution: fixed
Status: assignedclosed

(In [1465]) fixes #418

Note: See TracTickets for help on using tickets.