我正在使用以下代码...
169: const char *title = Title.c_str();
170: glutCreateWindow(title);
... Valgrind 给了我以下...
==28841== Conditional jump or move depends on uninitialised value(s)
==28841== at 0x6FF7A4C: (within /usr/lib64/libGLcore.so.180.44)
==28841== by 0x6FF81F7: (within /usr/lib64/libGLcore.so.180.44)
==28841== by 0x7289B36: (within /usr/lib64/libGLcore.so.180.44)
==28841== by 0x728A757: _nv000133gl (in /usr/lib64/libGLcore.so.180.44)
==28841== by 0x4EAB9E9: (within /usr/lib64/libGL.so.180.44)
==28841== by 0x4EAEA81: (within /usr/lib64/libGL.so.180.44)
==28841== by 0x4EB1D81: (within /usr/lib64/libGL.so.180.44)
==28841== by 0x4EA782B: glXCreateNewContext (in /usr/lib64/libGL.so.180.44)
==28841== by 0x54DF9AA: fgOpenWindow (in /usr/lib64/libglut.so.3.8.0)
==28841== by 0x54DE062: fgCreateWindow (in /usr/lib64/libglut.so.3.8.0)
==28841== by 0x54DF300: glutCreateWindow (in /usr/lib64/libglut.so.3.8.0)
==28841== by 0x4146CE: vimrid::glut::GlutApplication::Init() (GlutApplication.cpp:170)
但是什么是未初始化的?title 变量用 Title.c_str() 的值初始化,Title 是一个类成员,在构造函数成员初始化列表中初始化......
class VimridApplication
{
// ...
public:
std::string Title;
// ...
}
VimridApplication::VimridApplication() :
Title("Untitled VimridApplication")
{
// ...
}
class GlutApplication : public VimridApplication
{
// ...
}