It took me three weeks to find this mistake in a huge code base. Program suddenly crashes after the changes that look obviously innocent. And the root of all evil was not memory leaks or so but the #ifdef.
header.h
struct mystruct : somebasestruct {
mystruct();
#ifdef FEATURE_X
int somefield;
#endif
};
module1.cpp
#include ....
#include "header.h"
sizeof(mystruct) = 8
module2.cpp
#include ....
#include "header.h"
sizeof(mystruct) = 4
And guess why? Yes, check building settings, what is defined or not...
Showing posts with label caveats. Show all posts
Showing posts with label caveats. Show all posts
Monday, May 14, 2012
Subscribe to:
Posts (Atom)