i just wanted to report something funny that happened to me, well not sure if that's fun for you but when i realised i was kinda smiling
here it goes:
i had a class "SceneState" which represents all the entities in the current scene ( to save it to disk later ). Everything went fine and i used Ogre::SceneManager::MovableObjectIterator to get those entities.
In this class i had a std::vector<Ogre::Entity*>.
In my "SceneBuilder" module i declared a SceneState variable ( no pointer juste normal variable ).
And it ran fine. Then later, for "i dunno why i did that", i changed this variable from normal to pointer ( which i should have allocated with new and deleted at the end ).
Well after changing the get/setter methods i forgot to alloc it at init etc.
I kept on calling the function inside that class that was meant to build the scene state.
And i got NO PROBLEM calling it ... like if the method was static...
well in fact i got no problem as long as it didn't involve the vector's push_back method. But i could call QMessageBox( QT ) append to a QTextEdit control etc.
And when i realized i havent alloced the pointer i was really amazed because i know when u dont alloc a pointer nor initialize it on NULL it can point on any place in memory..
but how many chance of that to exist in reality ? i mean there was only one variable of this type in all my code, could the compiler kind of allocated for me ?
Is this even possible ? Not to initialize a pointer and get a 'good pointer' which class' methods were working ?
Now that i allocated it it fully works, vector's push back causes no more "Unhandled exception". I retried to not allocate it just to see. and now it crashes before entering the function so no more "bad-good pointer".
Could it be due to the fact that somehow my normal variable was still in memory ? and in the same exact adress ?
well that's all freakyness for today but it's just a fact that really surprised me ! And a behavior that by 8 years of c++ have never encountered.

