[Gambas-user] Bugs with conversion functions

Benoît Minisini gambas at ...1...
Sat Nov 3 18:45:53 CET 2012


Le 03/11/2012 16:24, Jussi Lahtinen a écrit :
> If I remember correctly this has been topic earlier... Was there some
> reason why Null is not accepted..?
>
> ? cint("0")
> 0
> ? cint("")
> Type mismatch: wanted Integer, got String instead
>
> At least error message is wrong (expected is variant).
> And I expect it to return zero.
>
>
> ? val("&H123123")
> 1192227
> ? cint("&H123123")
> Type mismatch: wanted Integer, got String instead
>
> Again at least error message is wrong. I expect it to return same as Val().
>
>
> These errors seems to apply to other conversion functions as well.
>
>
> Gambas 3 rev 5289 @ Xubuntu 12.04 64bit
>
> Jussi

If Gambas does not work like you think, it is not necessarily a bug.

First, a void string has never been a number.

As CInt() being unabled to understand the "&H..." syntax, I prefer that 
because it avoid many unexpected bugs that usually find with libc 
conversion functions.

I suggest you read the documentaion about CInt(), Val() and other 
conversion functions carefully.

-- 
Benoît Minisini




More information about the User mailing list