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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:05:31+00:00 2026-05-28T03:05:31+00:00

I defined a macro MYMACRO. Note: the value is not a valid NSString. #define

  • 0

I defined a macro MYMACRO. Note: the value is not a valid NSString.

#define MYMACRO is

The macro is used inside the declaration of a NSString

@"This MYMACRO fun"

However, the preprocessor does not expand the macro. The preprocessed result is

@"This MYMACRO fun"

The best solution I found so far to get the macro to expand is:

#define MYMACRO @"is"
@"This "MYMACRO@" fun"

The macro expands as below which is a valid Objective-C syntax:

@"This "@"is"@" fun"

However, this requires 2 concatenation at runtime.

So my question is how to insert a macro insto a NSString without using any string concatenation at runtime ?

Ideally, I would like the runtime execute @"This is fun" rather than @"This "@"is"@" fun"

  • 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-28T03:05:31+00:00Added an answer on May 28, 2026 at 3:05 am

    I’m fairly certain what you have is already concatenating at compile time, and not runtime.

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

Sidebar

Related Questions

Possible Duplicate: Problem with Macros Hi all I have defined this macro: #define SQ(a)
I have a macro defined in C something like this: #define SOME_FIELD(_A_,_B_,_C_) \ MyObj[
Suppose I have a macro defined as this: #define FOO(x,y) \ do { int
The macro is defined as: #define MAKEINTRESOURCEA(i) ((LPSTR)((ULONG_PTR)((WORD)(i)))) #define MAKEINTRESOURCEW(i) ((LPWSTR)((ULONG_PTR)((WORD)(i)))) How come this
I have seen this macro defined before but never really knew its purpose. Can
For example, never define a macro like this: #define DANGER 60 + 2 This
ATL END_COM_MAP macro is defined as follows: #define END_COM_MAP() \ __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr
I'm using a debug macro as defined in this post: How to print out
I defined a macro as follows: #define ccpd(__X__, __Y__) (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) ? CGPointMake(__X__
I want to have a macro dbtest that can be used like this: (dbtest

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.