Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anybody can decipher what this Macro means?

Status
Not open for further replies.

sulacco

Technical User
Nov 8, 2002
74
RU
Does anybody can decipher what this Macro means?
...
#define RUNTIME_CLASS(class_name) ((CRuntimeClass*)(&class_name::class##class_name))
I don't understand the last words:
&class_name::class##class_name

 
## is the concatentation operator for the preprocessor.

So when you say in the code
Code:
RUNTIME_CLASS(MyClass);

The compiler will see that as
Code:
((CRuntimeClass*)(&class_name::classMyClass));

--
 
I understand this but don't get the meaning of this piece:
Code:
(&class_name::classMyClass));
 
it means that class_name holds something called classMyClass (which the macro generates).

classMyClass holds info (a CRuntimeClass instance) about class_name.

/Per

"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."
 
Actually, when you run
Code:
RUNTIME_CLASS(MyClass);

it should be interpreted as:
Code:
((CRuntimeClass*)(&MyClass::classMyClass));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top