• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString equivalent of CFSTR macro?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString equivalent of CFSTR macro?


  • Subject: Re: NSString equivalent of CFSTR macro?
  • From: Ben Kennedy <email@hidden>
  • Date: Mon, 4 Dec 2017 14:51:30 -0800

> On Dec 4, 2017, at 2:47 PM, Rick Mann <email@hidden> wrote:
>
> #define NSSTR(s)                              (@ ## s) <-- magic; this
> doesn't work
> #define kSomeCStringConstant                  "foo"
> ...
> NSSTR(kSomeCStringConstant)

You're close. The preprocessor is removing the quotation marks, breaking the
syntax. You don't need to token paste; simply remove the '##' from the NSSTR()
def.

#define NSSTR(s) (@ s)

-b

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSString equivalent of CFSTR macro?
      • From: Greg Parker <email@hidden>
    • Re: NSString equivalent of CFSTR macro?
      • From: Rick Mann <email@hidden>
References: 
 >NSString equivalent of CFSTR macro? (From: Rick Mann <email@hidden>)

  • Prev by Date: NSString equivalent of CFSTR macro?
  • Next by Date: Re: NSString equivalent of CFSTR macro?
  • Previous by thread: NSString equivalent of CFSTR macro?
  • Next by thread: Re: NSString equivalent of CFSTR macro?
  • Index(es):
    • Date
    • Thread