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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:50:29+00:00 2026-06-02T16:50:29+00:00

I defined a series of string constants like below, in macro way, #define EXT_RESULT_APPID

  • 0

I defined a series of string constants like below, in macro way,

#define EXT_RESULT_APPID  @"appid"
#define EXT_RESULT_ERROR_CODE  @"errorcode"
#define EXT_RESULT_PROGRESS  @"progress"
...

All these constants are supposed to be used in same context, so I’d like to constraint them in a same namespace, and I don’t want to make them global, just like what this post said.

In the other hand, I could put all numeric constants in an enum but it doesn’t work for strings.
Then how could I group these related string constants?

  • 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-02T16:50:31+00:00Added an answer on June 2, 2026 at 4:50 pm

    Here’s one approach:

    MONExtResult.h

    // add __unsafe_unretained if compiling for ARC
    struct MONExtResultStruct {
        NSString * const AppID;
        NSString * const ErrorCode;
        NSString * const Progress;
    };
    
    extern const struct MONExtResultStruct MONExtResult;
    

    MONExtResult.m

    const struct MONExtResultStruct MONExtResult = {
        .AppID = @"appid",
        .ErrorCode = @"errorcode",
        .Progress = @"progress"
    };
    

    In use:

    NSString * str = MONExtResult.AppID;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I defined the Scheme procedure to return another procedure with 2 parameters : (define
I defined #define kTwitterOAuthConsumerKey @ Leu3YcKcTd4u2HsNw #define kTwitterOAuthConsumerSecret @ zp6WwVn6FfOIYD4st6jjjGNT8Cy8tT84YA1HB9Cts The request token for
I defined a simple Document, like this: class Company(Document): screen_name = StringField(max_length=100, required=True, unique=True)
I have defined a series of custom post types (namely PortfolioPage and PortfolioGallery). Each
I have a series of models for which I've defined factories. I also have
I am trying to write a macro that will be attached to a series
I have a non-straight line defined by a series of x, y coordinate points.
I have an Order class which goes through a series of defined states. To
I'm a Haskell beginner and have to define a series of known statuses that
There is series of functions like print_int, print_endline and Printf in OCaml. I can't

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.