[Gambas-user] If x <> +Inf Then [Error]
jussi.lahtinen at gmail.com
Wed Apr 19 02:49:06 CEST 2023
> I am away from my machine so I cant give a confirmed example, could be
> something like:
> If hObjectA.StringVar And hObjectB.StringVar Then
> needs to be parenthesized
> If (hObjectA.StringVar And hObjectB.StringVar) Then
> otherwise it evaluates the string lengths before the test, i.e. it "sees"
> the first as
> If (Len(hObjectA.StringVar)>0) And (Len(hObjectB.StringVar)>0) Then
> i.e. If ((1) And (1))
> or something like that anyway.
Here in both cases string lengths are tested to be non-zero. The condition
is true, if both of the strings are not null.
But parentheses can make a difference when mixing bitwise operations,
example these two are logically different:
If x = (y And z) Then
If x = y And z Then
> What I'm trying to say is that +/-Inf isn't the single root cause of the
> error, other things can do it too and sometimes it is hard to think the
> same way as the lexer and force the evaluation.'
The root cause is in the parser as the code cannot be compiled (it raises
false error). It's not about ambiguity.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User