[Gambas-user] Using shl and or in a mixed statement Causes error?

Jussi Lahtinen jussi.lahtinen at gmail.com
Sat Feb 19 01:55:57 CET 2022


Compiler warning, not error. I think it is a bug/false warning.
Curiously this returns true:
Print TypeOf((CInt(bDa) Shl 8)) = gb.Integer

And the warning disappears when using the old syntax (= better, in my
opinion).

Jussi

On Sat, Feb 19, 2022 at 2:36 AM Brian G <brian at westwoodsvcs.com> wrote:

> A program with the following code report a strange error, Or perhaps I am
> using thing incorrectly. But the outcome of the statement is correct. Does
> Anyone have any Idea, why this produces the following error message/warning:
>
> The Error:
>     Main : 11 : Integer and boolean mixed with `Or' operator
>
> The code:
> Public lAd As Long = 0
> Public bDa As Byte = 0
>
> Public Sub Main()
>   Dim lTemp As Long = 1
>   lAd = (CInt(bDa) Shl 8) Or lTemp
> End
>
> In A recent program I ended up with quite a lot of these errors!
>
> "Failure is the key to success;
>  each mistake teaches us something"  .. Morihei Ueshiba
> Brian G
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220219/e5c39275/attachment.htm>


More information about the User mailing list