not sure how exactly it would be done, but as much as i love TinyXml (and i do -- the company i work at uses it pretty exclusively -- we wrote a wrapper similar to paramio for developers who prefer that interface), it would be nice if when you tried to assign element or node values to std::string's without the TIXML_USE_STL macro set, it warned the user. not a big deal (maybe others have mentioned it before too or there is a way to prevent it / anticipate it). but in certain compilations, i.e., optimized ones, it will assign the const char * to the std::string and result in corrupted memory, and unless you remember the macro, it's kind of...strange.
apologize if this isn't that clear.
thanks again though for a great, clean library.
tom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
not sure how exactly it would be done, but as much as i love TinyXml (and i do -- the company i work at uses it pretty exclusively -- we wrote a wrapper similar to paramio for developers who prefer that interface), it would be nice if when you tried to assign element or node values to std::string's without the TIXML_USE_STL macro set, it warned the user. not a big deal (maybe others have mentioned it before too or there is a way to prevent it / anticipate it). but in certain compilations, i.e., optimized ones, it will assign the const char * to the std::string and result in corrupted memory, and unless you remember the macro, it's kind of...strange.
apologize if this isn't that clear.
thanks again though for a great, clean library.
tom
Could you give an example of code that would cause a warning? The following code should not compile:
const char *valc;
std::string valstr;
valc = valstr;
If that's what you mean then the compiler should already be warning you about it. The following code should compile and behave correctly:
const char *valc = "hamsters";
std::string valstr;
valstr = valc;
If that's what you mean then it shouldn't cause any problems.