[Bug] on compiler not detecting non existent variable

EduardoElias

Well-Known Member
Licensed User
Longtime User
I am using 2.71

I see sometimes the compiler gets lost, for example:


on class_globals the variable is defined like this
B4X:
   Public FOnUpdateItemPanel       As Object   = Null

However on the code is like this, note there is the missing 'F' on the front of the variable. There is no other sub, class, library or whatever with this same name.

B4X:
Public Sub SetOnUpdateItemPanel(Module As Object)
   OnUpdateItemPanel = Module
End Sub

The OnUpdateItemPanel is displayed in RED, but if you compile the application the variable is accepted.

I see this commonly happen when the variable names are changed, that is the case. I have changed a lot of variable adding the 'F' on the declaration and every place it needed to be changed the IDE was reporting, however on this place it did not report, besides remained in red, and compiler was succesful.

Thanks

Eduardo
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
This is because B4A does not force you explicitly declare a variable.
With out the 'F' it just creates a new variable. However you will see a warning for this.

Thank you in explain that, I used always to explicit declare variable because the other languages that I use.

I am sorry to not be aware of that and create this thread.


Eduardo
 
Top