Wish Compiler to detect bad variable initialisation in declarations

SteveTerrell

Active Member
Licensed User
Longtime User
I recently "incorrectly" had a line in Class_Globals

Public NAME_STRING As Int = "Not set"

The run time system detected the problem with an invalid floating point error message( "Not set" is of course not a floating point number and the type should have been String not Int) but the fault report did not give a line number or identify the variable concerned. Presumably because the initialisation was in Class_Globals and not in executed code.


Could this type of faulty initialisation have been detected at compile time? Perhaps limited to int and float must be assigned valid literal strings.