Just for fun, i kicked the warning level up from 4 to all on the caveman project. it did catch a few explicit conversions i missed.
after suppressing the "#ifdef symbol is undefined" and "padding data structure" warnings in the windows and directx headers, and the "inlining" and "not inlining" warnings from the linker, i set linker output to verbose. then i tried all the different verbose setttings. when i tried - show comdat folding, this is what i got:
1>------ Rebuild All started: Project: caveman, Configuration: Release Win32 ------
1>cl : Command line warning D9025: overriding '/sdl-' with '/GS-'
1> modeler.cpp
1> Z3D.cpp
1> Zaudio.cpp
1> caveman.cpp
1> Generating code
1> Finished generating code
1>
1> Selected symbol:
1> "public: __thiscall Zdrawinfo::Zdrawinfo(void)" (??0Zdrawinfo@@QAE@XZ) from modeler.obj
1> Replaced symbol(s):
1> "public: __thiscall drawrec::drawrec(void)" (??0drawrec@@QAE@XZ) from Z3D.obj
1> "public: __thiscall ttyperec::ttyperec(void)" (??0ttyperec@@QAE@XZ) from Z3D.obj
1> "public: __thiscall objtyperec::objtyperec(void)" (??0objtyperec@@QAE@XZ) from caveman.obj
1> "public: __thiscall plantrec::plantrec(void)" (??0plantrec@@QAE@XZ) from caveman.obj
1> "public: __thiscall chunk2::chunk2(void)" (??0chunk2@@QAE@XZ) from caveman.obj
1>
1> Selected symbol:
1> "void __fastcall remove_stuff_near_cave(int,int,int)" (?remove_stuff_near_cave@@YIXHHH@Z) from caveman.obj
1> Replaced symbol(s):
1> "void __fastcall remove_stuff_near_rockshelter(int,int,int)" (?remove_stuff_near_rockshelter@@YIXHHH@Z) from caveman.obj
1>
1> Selected symbol:
1> "void __fastcall runstate_cornered(int)" (?runstate_cornered@@YIXH@Z) from caveman.obj
1> Replaced symbol(s):
1> "void __fastcall run_defend_location_attack(int)" (?run_defend_location_attack@@YIXH@Z) from caveman.obj
1>
1> Selected symbol:
1> "void __fastcall generate_CB2(int,int,int,int)" (?generate_CB2@@YIXHHHH@Z) from caveman.obj
1> Replaced symbol(s):
1> "void __fastcall generate_non_tropical_savanna_tree(int,int,int,int)" (?generate_non_tropical_savanna_tree@@YIXHHHH@Z) from caveman.obj
1>
1> ICF total savings: 774 bytes
1>
1> caveman.vcxproj -> C:\Rockland\caveman\Release\caveman.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
so this means that, for example, remove_stuff_near_rockshelter and remove_stuff_near_cave are identical at the object code and/or machine code level?
i understand the concept of how this could be, just want to confirm i'm reading this output correctly.
and:
1> Selected symbol:
1> "public: __thiscall Zdrawinfo::Zdrawinfo(void)" (??0Zdrawinfo@@QAE@XZ) from modeler.obj
1> Replaced symbol(s):
1> "public: __thiscall drawrec::drawrec(void)" (??0drawrec@@QAE@XZ) from Z3D.obj
means that internally the compiler is creating code that returns a pointer to a struct, and is using the same code for all? (all the symbols listed in this case are POD structs).
is it folding them because the structs just happen to be the same size, perhaps?