Cheedoong / xml2json

A header-only C++ library converts XML to JSON

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error - Local pointer not initialised

zoenie123 opened this issue · comments

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?

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!

Ok, issue closed