Saturday, July 25, 2009

The benefit of using __declspec

  • Only applied to pure interface class
  • Compiler stop initializing the vfptr in constructor and destructor.
  • Only references to the vtable that are associated with the class will be remove.
  • Can reduce code size.
I don't know where did I get the above mention notes but I did jot it in my notebook. I think it should be use with novtable storage-class attribute. It suppose to be use with other Microsoft specific storage class attribute and shouldn't be standalone.

I found an article which describe how this keyword can help in code optimization, how the code will improve when disabling vtable initialzation, and how to indicate a function not to throw an exception.

No comments: