Compilation error - Local pointer not initialised
zoenie123 opened this issue · comments
Jeroen De Maeijer commented
c:\development\xml2json.hpp(162): error C4703: potentially uninitialized local pointer variable 'name_ptr' used
What would be the solution for this?
Initialising "const char *name_ptr;" by changing it into "const char *name_ptr=0;" does not seem like the correct solution to me as this could cause a crash on a null-pointer.
Would the answer be: const char *name_ptr=""; ??
Or would you suggest another change?
Cheedoong Ch'ng commented
Following the logic, in each recursive process round upon one node, name_ptr cannot be NULL.
Anyhow, I changed the code:
const char *name_ptr = NULL;
and
if (name_count[current_name] > 1 && name_ptr)
Check it!
Jeroen De Maeijer commented
Ok, issue closed