Hi all,
in my application I am dynamically creating an array of structures to hold testing parameters for all tests executed. The structure includes another array of structure and is created global by typing it in a .h file included in all source files.
The problem is that sometimes while running the project in debug mode I get the error "Warning: local 'gp' has not been inizialized" or some other times "..
fully initialized". However, this is only a warning and the application starts and runs correctly even when executing the routine that raises the error. Besides it, 'gp' is NOT a local variable, and is SURELY inizialized since I am creating it with calloc ()!
I get no errors nor warnings while creating the executable in release mode.
What can be happening?
My structure:
typedef struct { // Parameters
// The structure includes some ints, next:
int idx; // Index of the active testing stand
// next other ints, doubles and char[] variables
} carParm;
typedef struct { // Parameters
// The strucuter includes some ints and doubles, next:
carParm cp[5];
//next some unsigned char[]
} grpParm;
grpParm *gp;
// Dynamically allocating memory
nullChk (gp = calloc (size, sizeof (grpParm)));
The routine that gives the error:
int CVICALLBACK ViewImpoFromGroup (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int ngr, ncar;
if (event != EVENT_COMMIT) return 0;
GetCtrlVal (panel, grp_ngr, &ngr);
switch (control) {
case grp_c1: ncar = 1; break;
case grp_c2: ncar = 2; break;
case grp_c3: ncar = 3; break;
case grp_c4: ncar = 4; break;
}
cv = gp[ngr].cp[ncar].idx; // <<== The line with the warning
// 'cv' is a global variable
LoadImpoPanel (1);
return 0;
}