[Gambas-devel] Type mismatch: wanted Byte[], got Integer[] instead

Benoît Minisini gambas at ...1...
Wed Aug 11 13:15:02 CEST 2010


> Hi,
> 
> "Type mismatch: wanted Byte[], got Integer[] instead"
> 
> I get the above error on the following code line while running my
> project... is this expected behavior or did I miss something?
> 
> Dim b1 As Byte[] = [CByte(&HF0), CByte(&H33), &HF0, &H33]
> 
> Worked with Gambas2.
> 
> The following changes seems to fix it, but what an overhead...
> 
> Dim b1 As Byte[] = [CByte(&HF0), CByte(&H33), CByte(&HF0), CByte(&H33)]
> 
> 
> Now running Gambas3 rev 3098 on Ubuntu 10.04
> 
> Regards,
> Ron.
> 

Alas you have to do that. Numeric constants are all integers, and Gambas 3 
checks all datatypes inside the [...] operator. Gambas 2 did differently.

I see two possible solutions:

1) Create a syntax for byte/short constants. I have no idea of syntax at the 
moment.

2) Make "= [ ... ]" a special syntax managed by the compiler, so that it 
automatically converts the constants when initializing the array.

But that needs some thought...

-- 
Benoît Minisini




More information about the Devel mailing list