[Gambas-user] gb.args: Negative numbers as arguments

Tobias Boege taboege at ...626...
Sat Nov 15 11:51:57 CET 2014


Hi,

with the attached project, negative numbers (indicated by a minus sign in
fron of them) are treated differently under various circumstances:

0. Setup:
     $ tar -zxvf ColorSelect-1.1.37.tar.gz
     $ cd ColorSelect
     $ gbc3 -ga
     $ gba3
   Nothing to see here.

1. gbr3 -- everything as expected:
     $ gbr3 ColorSelect.gambas -- -10 10 10
   Correctly transfers the "-10" as an argument to the program which then
   displays an error.

2. gbx3 -- not working:
     $ gbx3 -- -10 10 10
     ColorSelect: unknown option: -1

3. gbx3 (when the project does NOT call Args.End()) -- working:
     $ vim .src/FColor.class  # Remove the Args.End(), line 17
     $ gbc3 -ga
     $ gbx3 -- -10 10 10
   Correctly transfers the argument.

(Now change the FColor.class back to again contain the Args.End() and
 recompile.)

4. gbx3 (with a cheap masking trick) -- working:
     $ gbx3 -- " -10" 10 10
   Correctly transfers the argument and Val()'ing it does the trick.

Why does gbr3 get it right? Why does the behaviour seem to depend on the
call to Args.End()? How are negative numbers supposed to be given here so
that gbr3 and gbx3 can handle them both (and not contain superfluous
whitespace)?

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ColorSelect-1.1.37.tar.gz
Type: application/octet-stream
Size: 8113 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20141115/92dd9787/attachment.obj>


More information about the User mailing list