The uVision3 IDE watch window shows the value of pString incorrectly (when stopped on a breakpoint in the "bug" function), unless pString is actually referenced in the function (by, for example, uncommenting the line "pString[0] = 0"). This is true even if the code optimizations are set to the lowest level possible.
#include <string.h> int bug(int *nState,char *pString) { *nState = 0; // pString[0] = 0; return(0); } void main(void) { int foo = 0; char *bar; char s[] = "KEIL uVision3 for ARM\r"; bar = s; bug(&foo,bar); while(1); }
But if the parameter is never used within the function, does it actually matter what value it has? If the value is never used, then the fact that it might be wrong has no effect, surely?