[Gambas-user] Bugs with conversion functions
Jussi Lahtinen
jussi.lahtinen at ...626...
Sat Nov 3 23:41:06 CET 2012
I didn't mean that.
Cint("0") will return 0 as expected, but cint("blaablaa") returns confusing
error message.
I think instead there should be something like "Conversion error from
String to Integer".
But maybe that is not that big problem, even though it is not really type
mismatch (variable type is correct, content isn't).
I expected "" to return zero, because it is closest interpretation.
But I understand well the choice to raise error instead.
Jussi
On Sat, Nov 3, 2012 at 9:59 PM, Emil Lenngren <emil.lenngren at ...626...>wrote:
> It's the same in VB. If you run CInt("some string") you get the same error
> message. I think it's better to throw an error message rather than
> returning 0 or something...
>
> /Emil
>
> 2012/11/3 Jussi Lahtinen <jussi.lahtinen at ...626...>
>
> > > First, a void string has never been a number.
> > >
> >
> > Yes, but, why "Type mismatch: wanted Integer, got String instead"?
> > "0" is also *string* and it is accepted.
> >
> > Also booleans are accepted and interpreted as False = 0, True = -1, which
> > is not the way Boolean algebra works.
> > But that is OK, because it is the usual way things work in computers.
> >
> > So I don't think my question was so far fetched.
> >
> >
> >
> > 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.
> > >
> >
> > OK.
> >
> >
> > Jussi
> >
> >
> ------------------------------------------------------------------------------
> > LogMeIn Central: Instant, anywhere, Remote PC access and management.
> > Stay in control, update software, and manage PCs from one command center
> > Diagnose problems and improve visibility into emerging IT issues
> > Automate, monitor and manage. Do more in less time with Central
> > http://p.sf.net/sfu/logmein12331_d2d
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list