For the love of all that is Holy

Jon

25-05-2007 04:33:44

I spent most of the day struggling with what may be a bug in VS2005. Now, I hate people blaming the compiler for their own shortcomings, but I'm not sure what else this can be.

Two methods in the same object... defined in the same source file... each prints sizeof(class) to a log... Both methods accessed through the same pointer... different values logged. Note: same pointer means same type and same value. The entire solution was rebuilt several times.

I always thought that sizeof(foo) was calculated at compile time, especially for a class -- i.e. sizeof (PagingLandScapeSceneManager). In that case, when the source file is compiled, the constant size is placed in that object file, and when control gets to that method there should only be one value printed out.

I've stepped through the code in the debugger, and got nowhere. Finally I threw in the towel and coded around it. Luckily this is just debug code.

I just had to vent.

sklug

26-05-2007 05:50:34

I just have to say, YIKES! Check the disassembly to see what it's doing.

--sklug