View Single Post
voogru
Inspector Javert
Join Date: Oct 2004
Old 01-15-2011 , 09:06   Re: undefined symbol from my own plugin
Reply With Quote #16

Quote:
Originally Posted by PM View Post
No, what sn4k3 has basically written is

Code:
#define LIB_SIGSCAN_CLASS CSigScanLib
 
// (.h file)
class LIB_SIGSCAN_CLASS
{ 
  bool Load(KeyValues *kvSigscan);
  // ...
};
 
// (.cpp file)
bool LIB_SIGSCAN_CLASS::Load(KeyValues *kvSigscan) {
   // function body
}
So he declares class CSigScanLib, where he declares the Load function.
Then in the .cpp file he provides the function definition of CSigScanLib::Load.
This is valid C++ code and will compile&link properly.

I don't see a reason to use the preprocessor macro there but it also doesn't do any harm.
It doesn't do any harm.

But for the life of me I can't think of why someone would use a #define macro that is longer than the actual class name for a class name.

The only case I can see that being done is by an employee of a large corporation that is trying to get more typing done without actually accomplishing anything more.

voogru is offline