Hello. I am trying to find new and exciting ways to optimize (read: shrink down) my current code and want to include an eeprom autorefresh option to cut down on variables. Basically, when I have the AutoRefreshCompile option set, I want it to create the variable "randomvariable". My code is pretty simple:
#define AutoRefreshCompile 1 #if(AutoRefreshCompile==1) { // line x extern signed short randomvariable; } // line y #endif
I am getting errors that read as follows:
VARS.H(x) error C141: syntax error near '{' VARS.H(y) error C141: syntax error near '}'
I'm guessing it is not possible to do this (if I remember correctly, variables have to be declared at the beginning and can't be in the middle of functions/code segments but maybe it's some really simple fix.
I realize this might not work but I figure it's worth a shot. Any suggestions? Thanks!
optimize (read: shrink down) my current code and want to include an eeprom autorefresh option to cut down on variables
So how did you figure adding stuff whould shrink down your current code?
Hans, I ADDED preprocessor statements to REMOVE parts of code that are not always needed by setting a bit. Where did I lose you?
And as far as the previous suggestions go, you are 100% correct and brackets are not allowed in vars statements so it was a straight forward issue (and, as suggested, you are correct, I was lacking information). I now understand a bit better the limitations of what you can or cannot place in those files. I appreciate all the help! This should be the last little piece to further optimize. Thanks again for all your help!
That doesn't actually make sense.
I think you may still need to take some more time to too fully get to grips with the meaning of braces (aka "curly brackets"), and where they are allowed...?
View all questions in Keil forum