Visual Studio auto generated function only when class has pointer member

▼魔方 西西 提交于 2021-01-29 04:20:31

问题


I was playing around with DIA SDK today, trying to print all the functions in a .pdb file generated by VS(2012). In the output I noticed a function called __autoclassinit( with an unsigned int as a parameter ) was generated for one my test classes (the only with with a pointer member).

Google failed to return any results so I ask you: what does this function do? and why isn't it used for references too?


回答1:


First google hit for "__autoclassinit"

blogs.msdn.com...

...compiler will generate a new function called A::_autoclassinit(). This function is responsible for the initialization of class member pointers. It will also call the compiler-generated class initialization functions of any base classes or member variable of a class type. For our example the A::_autoclassinit() function is called before the call to the constructor: ...



来源:https://stackoverflow.com/questions/20514856/visual-studio-auto-generated-function-only-when-class-has-pointer-member

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!