[Insight-users] What's # in "#thisClass"?

Yuanxin Zhu zhu4 at scripps.edu
Wed Jul 14 15:36:37 EDT 2004


Hi David,

Thank you very much for your quick help. I did find the description in my
other book "The C Programming Language (2nd Ed. by Kernighan and Ritchie)".

Best wishes,

Yuanxin

On Wed, 14 Jul 2004, David Gobbi wrote:

> Hi Yuanixin,
>
> The "#" is part of the magic of the C preprocessor.
> If you have #thisClass inside the body of the macro,
> then the preprocessor puts quotation marks around
> the value that "thisClass" expands to.
>
> So   itkTypeMacro(MyClass)
>
> results in
>
>      { return "MyClass";}
>
> For more information, look for "preprocessing" in the index
> of your C++ book.
>
> Cheers,
>  - David
>
>
>
> On Wed, 14 Jul 2004, Yuanxin Zhu wrote:
>
> > Hi there,
> >
> > I'm new to ITK and haven't touch C++ for quite a few years. While I read
> > itkMacro.h, I found the following statement for itkTypeMacro():
> >
> > #define itkTypeMacro(thisClass,superclass) \
> >     virtual const char *GetNameOfClass() const \
> >         {return #thisClass;}
> >
> > My question is what the "#" in front of "thisClass" stands for. My guess
> > is that it should be an operator to get the type of a class. But I can
> > NOT even spot it in "The C++ Programming Language (3rd Ed.)". Is the book
> > is too old to be a C++ reference?
> >
> > Anyone has a clue?
> >
> > Thank you in advance.
> >
> > Yuanxin
> >
> >
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
> >
>
>



More information about the Insight-users mailing list