LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

"Local" variable not initialized

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;
}


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 3
(3,297 Views)
Hi Roberto,

See this thread that I started some time back (http://forums.ni.com/ni/board/message?board.id=180&message.id=9435&requireLogin=False). The problem you are seeing is probably the same and has been fixed at the latest release of CVI (I forget at exactly which release it was fixed).

Nice to be able to help out such a stalwart of the CVI forum!

Best wishes

Jamie Fraser

Message Edited by Jamie Fraser on 06-23-2005 07:04 AM

Message Edited by Jamie Fraser on 06-23-2005 07:05 AM

0 Kudos
Message 2 of 3
(3,293 Views)
Dear Jamie,

effectively it seems that the situation is quite similar to mine. The only problem is that I am working in CVI6, which seemed not to suffer from this problem!

I have made some tests in CVI7.1 and effectively this error seem disappeared. Unfortunately this application includes some libraries I'm not ready to upgrade to CVI 7 now, so I could make a partial test only; besides it, it is already distributed to some customers of mine and it's not so easy to upgrade them rapidly to version 7. Anyway, the discussion I saw confirmed my impression that this is a cautelative warning without effect to actual application.

Many thanks to let me know this thread.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(3,275 Views)