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 976133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:41:55+00:00 2026-05-16T03:41:55+00:00

My problem is quite simple. I want the following macro #define PROXYPASS(name, param) \

  • 0

My problem is quite simple. I want the following macro

#define PROXYPASS(name, param) \
void MyClass::sl_name(param _param) { \
    emit name(_param); \
}

to expand PROXYPASS(clientAdded, Client*) to:

void MyClass::sl_clientAdded(Client* _param) { \
    emit clientAdded(_param); \
}

but since it ain’t working i.e. it still shows just sl_name instead of sl_clientAdded. So, this is what I’m using:

#define PROXYPASS(name, param) \
void MyClass::sl_ ## name(param _param) { \
    emit ## name(_param); \
}

It works fine, other than the fact that it expands to:

void MyClass::sl_clientAdded(Client* _param) { \
    emitclientAdded(_param); \
}

Everything is fine other than the fact that there is no space between emit and clientAdded i.e. it expands to emitclientAdded instead of emit clientAdded. So how do I go about doing it? Is there a way to add spaces, or must I look for another way. A lot of googling has got my hopes down due to the following statement: Whether it [gcc pre-processor] puts white space between the tokens is undefined.

My other failed attempts include

emit ## ## name(_param);
emit ## /* */ ## name(_param);
emit ## \ ## name(_param);
emit /* */ ## name(_param);
emit ## space ## name(_param); [#define space \ ]

Any help is greatly appreciated.

NOTE: Preprocessor output and macro expansion checked using gcc -E myclass.cpp.

  • 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-16T03:41:55+00:00Added an answer on May 16, 2026 at 3:41 am

    Just put nothing there, you don’t need to concatenate anything:

    #define PROXYPASS(name, param) \
    void MyClass::sl_ ## name(param _param) { \
        emit name(_param); \
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is quite simple: I have a 400MB file filled with 10,000,000 lines
Today we faced a quite simple problem that were made even simpler by the
My problem seems to be quite simple, but it's not working the intuitive way.
I've never learnt JavaScript, but I imagine this is quite a simple problem. Just
I've got a quite strange problem here. I'm calling some simple code via Ajax.Updater:
I have a quite simple problem but i can't seem to resolve it. Let's
I have following problem. I want to create a file system based session storage
The problem I am trying to solve is quite simple. When I open the
Say I want to make a Clojure macro that does the following: If x
I'm quite new to R and I have a following problem: I have a

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.