Hello!
Suddenly we have problems with variables that are located in CODE space. We declare them with 'uint code varname[8] = {value1, value2,..etc.}'. The normal way.
After compilation we load the HEX file into HiTop. If I then look into the code space where the variables are located, the values are changed.
The C51 compiler config was not changed and this hasn't happen before.
Any clue? We are desperate. After years of using Keil C51 package and Hitex Hitop 4.11 with DProbeHS we never had such an error.
TIA.
Not sure what you are trying to say.
There are no specific rules how to initialise a char array (=string, if it has EOL). From my logic, = 0 and = "" are the same. In both cases, the compiler should produce an array, initialised with 0.
Have you read chapter 6.7.8 of the ISO/IEC 9899:1999 standard?
Please focus specifically on points 14, 15 and 16 which regulates semantics:
14: An array of character type may be initialized by a character string literal, optionally enclosed in braces. Successive characters of the character string literal (including the terminating null character if there is room or if the array is of unknown size) initialize the elements of the array.
15: An array with element type compatible with wchar_t may be initialized by a wide string literal, optionally enclosed in braces. Successive wide characters of the wide string literal (including the terminating null wide character if there is room or if the array is of unknown size) initialize the elements of the array.
16: Otherwise, the initializer for an object that has aggregate or union type shall be a braceenclosed list of initializers for the elements or named members.
Basically, the following holds:
- The general case is: array initializers do require curly braces.
- The special case: a character array can be initialized using a character string literal.
- An array can not be initalized with null.