Jump to content
  • Advertisement
Sign in to follow this  
jamesleighe

Token Pasting Operator Woes

This topic is 2588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so is this proper use of the token-pasting and stringizing operator? It seems I'm making a mistake somewhere...


#define LINK_TO_ENTITY_FACTORY(className) \
IEntity* Create##className () \
{ \
return new className; \
} \
\
EngineAPI ()->LearnEntity (#className, Create##className);


Thanks as usual!

Share this post


Link to post
Share on other sites
Advertisement
iI don't know if you missed it or if the forum software just mangled your post, but multi-line macros must use \ characters at the end of each line to correctly continue after the break.

If that doesn't take care of it, you can configure the compiler to show you how it expanded the macro, which can help spot mistakes. The specifics depend on what particular compiler you're using.

Share this post


Link to post
Share on other sites
I never knew you could have VS spit out that kind of information!
Anyway, seems that it's working right and the problem must be somewhere else.

Thanks!

Share this post


Link to post
Share on other sites
Hidden
What does the signature of LearnEntity() look like? You seem to be passing it a class name as the first parameter, which would be invalid syntax.

Share this post


Link to post
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!