supaphon / ticpp

Automatically exported from code.google.com/p/ticpp
0 stars 0 forks source link

Uninitialized local variable returned from Node::GetAttribute<> #53

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

When Node::GetAttribute is called with any POD type for a node which
doesn't contain the attribute specified, the value returned is undefined.
It causes a debug break in VS: "Variable used without being initialized".

E.g.:
bool res = node->GetAttribute<bool>("something", false);

To fix it, replace:
T value;

with
T value = T();

Original issue reported on code.google.com by ybungalo...@gmail.com on 24 Jul 2009 at 6:26