Acknowledged

Since Connect Iq 4.1.6 the compiler errors on undefined symbols (type checking off)

In Data Lover I have excluded annotations, for example has_pressure

fr245m.excludeAnnotations=has_pressure  
 

at certain points I'm using this in my code, for example in the declaration

    (:has_pressure)
    hidden var presUnit = 1.0;
at other points I'm not using them, because I don't like to duplicate my functions for all possible excludeannotation patterns
function getIteratorMultiply (bChart)
    {
        if (bChart == 23) {
            return presUnit;  // no exludeAnnotation here
        } else {
            return 1.0;
        }
    }
while from a compiler point of view this could fail, I know that bChart can never be 23 for devices that don't have pressure.
and sure it would be nicer if I excluded code at all places to make the compiler happy
and sure it would be nicer if I used type checking everywhere, but this project has grown historically.
Works fine  to compile with SDK 4.1.5
Fails to compile with SDK 4.1.6 and SDK 4.1.7 (error message: ERROR: fr245m: C:\_Personal\git\connectiq\DataLover\source-device\Fr245m.mc:113,20: Undefined symbol ':presUnit' detected. )
you shouldn't hold hands for developers who want to have type checking off (and you should definitely not enforce them to follow your ideal coding convention)
 
  • You're missing the point Richard. I don't want to check everywhere if presunit exists. The project does not have type checking and I don't want to be errored out on undefined symbols. 

    I also don't like I would need to add extra code to solve cases like these, this extra code adds:

    - adds code litter 

    - adds memory pressure ( I'm very close to the limit.)

    - adds processing time (and battery waste)

    If type checking is off then don't error on undefined symbols. At most it should be a warning, it should not prevent to compile.

  • I'm told that this can be done by using the following annotation type. 

    if ($ has :presUnit) {
    }
  • I also had similar problems. My solution is to use (:base) annotation. Add:

    (:base)
    hidden var presUnit;

    It shouldn't add anything to the code/data (will be removed by the compiler) but will make the compiler happy.