3 ms·
My favorite bug came just after starting a job. There was a C++ program that was being run 32-bit on servers with 8GB of memory, back when that was a lot, beca
by saalweachter 13y ago
My favorite bug came just after starting a job. There was a C++ program that was being run 32-bit on servers with 8GB of memory, back when that was a lot, because it would crash when compiled 64-bit. I was assigned the task of making it work.
After many, many fruitless debug sessions the problem turned to be that the structure packing was different between two different compilation units. In some compilation units a particular structure was 56 bytes, in others 48 (or something like that). This was Bad.
There was an unterminated pragma-pack which was included in some compilation units but not others. In 32-bit mode it didn't cause any problems, because the structures were optimally packed anyway, but in 64-bit mode, when pointers were 8 bytes, the structures packed differently when the unterminated pragma-pack was included in the header before them.