问题
I use a GLMmodel object in order to represent a Google Sketch Up model in a C++ program. These objects have a member (vertices) that contains a list of all the vertices of the object in a way like this: [GLfloat x component of vertex 1, GLfloat y component of vertex 1, GLfloat z component of vertex 1, GLfloat x component of vertex 2...]. When I read all these values I get small numbers for all of them except for the first three ones (the coordinates of the first vertex) which are all three -431602080.000000. This doesn't make sense in my program. I've googled it and I've found this value appears frequently in C++ programs but I don't know what does it mean. Any ideas?
回答1:
Yes, this is a "magic value". When you look at the variable with the debugger, using hex view, you'll see 0xcdcdcdcd. That's not an accidental value, that is a value used by the Microsoft CRT's debug allocator. For one, possibly others. Which initializes any memory you allocate with malloc or new to this value. It isn't that clear with variables of type float or double of course, easier with ints and strings and especially useful with pointers. Assuming you are using the MS CRT, debug allocator magic values are documented here.
You forgot to initialize the value. That's a bug in your code.
来源:https://stackoverflow.com/questions/10155491/what-does-431602080-000000-value-in-glmmodel-vertex-means