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

  • Home
  • SEARCH
  • 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 8900379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:05:20+00:00 2026-06-15T01:05:20+00:00

The idea is to create automatic caster which would paste pointer to the variable

  • 0

The idea is to create automatic caster which would paste pointer to the variable based on given prefix and number.
Lets say you have some interface which is continously developed so you get some new structure versions every couple of weeks. So instead of writing explicity “(structure1*), (structure2*)” and so on you could just use SOME_DEFINE(thisStructure, version); which would handle the case

I thought that this would do the trick

#define d1(x) x
#define d2(x,y) x##y

void someFunction()
{
    int temp = 3;
    d2(myStructure,d1(temp)) *thisStruct;
}

i was hoping that preprocessor would nest itself and paste d1 operation first and then merge result of d1 operation with first d2 argument. However it doesnt work, so my question is, how can i achive this cause it seems to be possible.

  • 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-06-15T01:05:21+00:00Added an answer on June 15, 2026 at 1:05 am
    #define d2(x,y) x ## y
    
    void someFunction()
    {
        int temp = 3;
        d2(myStructure,temp) *thisStruct;
    }
    

    The preprocessor converts this to:

    void someFunction()
    {
        int temp = 3;
        myStructuretemp *thisStruct;
    }
    

    If you want to replace the ‘3’ in there so you get myStructure3, then you cannot do that with the preprocessor – it doesn’t know anything about C/C++ variables or their values.

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

Sidebar

Related Questions

Working with Unity, I thought it would be a good idea to create some
idea I would like to create a little app for myself to store ideas
I'm programming in PHP and would like to create web pages which have email
I recently had an idea to create my own String class to make using
Is it a good idea to create a lighter version of an Entity in
I'm not sure if its the best idea to create a background job that
In short, when you have planned or have thought about an idea to create
My idea is to create a .jar file that contains Services managed by Spring,
Has anybody got an idea of how to create a .Contains(string) function using Linq
I am trying to create an OSGI project on IntelliJ Idea but so far

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.