Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 996583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:53:53+00:00 2026-05-16T06:53:53+00:00

I have a case where I’m using a macro to generate simple subclasses. I’ve

  • 0

I have a case where I’m using a macro to generate simple subclasses. I’ve currently got it defined as:

#define REGISTER( TYPE, NAME )                     \
    struct NAME ## Class : public ParentClass      \
    {                                              \
        NAME ## Class () : ParentClass ( # NAME ); \
    }

I really want the Name to contain a period, but then the macro gets expanded to this and doesn’t work:

struct Simple.ClassClass : public ParentClass
{
    Simple.ClassClass () : ParentClass ("Simple.Class");
};

Is there anyway to use a preprocessor definition to get rid of the period in the name? Then I could keep the period in the string (as desired) and have the class name use a different (legal) character.

The class name doesn’t matter (as long as it’s unique). The only thing that matters is the readable string.

I have access to Boost.Preprocessor, but I couldn’t understand if any of it would be useful for this.

Thanks.

EDIT: The reason behind this is I’m implementing the Industrial Strength Pluggable Factories as a template and a macro for easy generation of the maker class. There may be a lot of maker IDs though so I want the ability to “namespace” them by using a dot. I’m doing it right now with underscores already, I was just curious if I could get it working with a dot instead because I find it more visually pleasing. The only important part is that since another person besides me who is writing code would not see the code the macro generates, the macro can’t do any insidious stuff behind the scenes. So whatever string gets put in as the name must be the key used to retrieve the item.

I relooked at the problem this morning and I think I can just avoid macros all together. Thanks anyway.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:53:54+00:00Added an answer on May 16, 2026 at 6:53 am

    I don’t think you can mainipulate the parameter NAME att all, beside concatenate it with another string. So the obivous solution is no to use a string that contains dots.
    REGISTER(whateverType, SomethingwithoutDot)

    I know it doesn’t answer your question but it seems to me that you should take a look on the problem that you try to solve with this macro and maybe find another way solving that problem instead. I would think will it be more productive

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 528k
  • Answers 528k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Does that work in IE6? No, IE6 does not support… May 16, 2026 at 11:07 pm
  • Editorial Team
    Editorial Team added an answer You have the HREF int he anchor, so all you… May 16, 2026 at 11:06 pm
  • Editorial Team
    Editorial Team added an answer default printer settings? report page setup? May 16, 2026 at 11:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have case where I want a database user to have db_owner privileges with
how can i optimized this code? i dont like to have case statement, is
I have case like this: JS100829 0001 JS100829 0002 JS=code 10=year 08=month 29=date 0001=the
My case: I have an app.exe and several dlls for it -- a.dll, b.dll,
I have a use case where my GWT application is running on a client
I have this select Case SQL statement which compute the totalvolume of a given
I have a special case Model which must not become part of an outer
I have a French site that I want to parse, but am running into
I've got a string that has curly quotes in it. I'd like to replace
I have table mytable where value of column myValue is null. I have application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.