Compiler warnings: quite valid, but can I bypass them? Or an alternative approach?

Hi,

Ok, I probably already know the answer to this, but...

I have localised a couple of products and the compiler, correctly, is trying to make me localise all my strings and gives me a warning for two that I have explicitly not localised.

But...

One of them is just a display constant to satisfy a customer request, but the other one is a flag - therefore NEITHER string should be localised.

This is just a minor irritation - software performing correctly, but not how I dream it to be. But it prompts the question: is there a better way?

Specifically:

Edge130 is monochrome where no other Garmin device seems to be. Therefore, I need to have a means to DETECT  monochrome / Edge 130.

The method I have used is this:

1. In my base "resources" I have "monoStrings.xml" containing a single string value

2. I also have "resources-edge130" where the same string is overridden to something that I can test for

If the string is the Edge130 value, I know I have a monochrome display and can respond appropriately.

Is there a better way to detect a specific Garmin device at runtime?

Thanks,

G

  • You might consider doing it at compile time with jungles.  Here is what I do for the rino and oregon, where I want to have some screen buttons.  Those devices don't have even the common physical buttons 

    base.excludeAnnotations=useScreenButton
    oregon7xx.excludeAnnotations=noScreenButton
    rino7xx.excludeAnnotations=noScreenButton

    so for most devices, I exclude "useScreenButtons", while for the oregon/rino, I exclude "noScreenButtons", and then in the code, I use those annotations to decide what to do

    you could do something like

    base.excludeAnnotations=monochrome
    edge130.excludeAnnotations=notMonohrome

    and in the code

    (:monochrome)
    function isMonochrome() {return true;}
    
    (:notMonochrome)
    function isMonochrome() {return false;}

  • I like that a lot - and I haven't yet tried annotations, so it will be something new to experiment with.

    Do you know whether I can use them for var rather than method though?

    I have been running so close on memory that I have found the need to go in line rather than methods simply to save space.

    EG: It is more efficient by a good few hundred bytes (however ugly) to do this:

    do {
    	value[i] = minDial + zones[i]*range;
    	i++;
    } while(i < len);

    Than this:

    do {
    	value[i] = myFunction(i);
    	i++;
    } while(i < len);
    
    
    functon myFuncton(index) {
        return minDial + zones[index] * range;
    }

    So if I could have:

    (:monoChrome)
    hidden var isMono = true;
    (:notMonoChrome)
    hidden var isMono = false;

    I would be much happier.

  • Perfect!
    And saves me 20 bytes or more of memory to do so!