• 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
Preprocessor macro concatenation...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Preprocessor macro concatenation...


  • Subject: Preprocessor macro concatenation...
  • From: Ralf Hasemann <email@hidden>
  • Date: Thu, 7 Sep 2006 21:55:27 +0200

Hi all!

this is not a real Cocoa question - I hope that don't mind.
I am "fighting" adainst the C preprocessor at the moment.
What I like to do is create a #define that does the following:
Inserting a variable with the current source code line number in its name.
Example:


NSString* strNr_25 = [NSString string];

Where 25 is the number of the line in the code file.

The standard predefined macro __LINE__ inserts the current line number.
So far - so good.

but when I try the following:

#define LineString NSString* strNr___LINE__ = [NSString string];

the __LINE__ macro is not replaced because it is joint to "strNr_" and therefore
not recognized by the preprocessor.


The question is now: Is the a way (a trick / hack) to concatenate the __LINE__
macro with a string within a define??


Thank you for any help!

Regards,
Ralf Hasemann
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Preprocessor macro concatenation...
      • From: "Shawn Erickson" <email@hidden>
    • Re: Preprocessor macro concatenation...
      • From: Rush Manbert <email@hidden>
  • Prev by Date: Mouse Over and Popup in TextView
  • Next by Date: Re: CoreData transient attribute memory leak?
  • Previous by thread: Mouse Over and Popup in TextView
  • Next by thread: Re: Preprocessor macro concatenation...
  • Index(es):
    • Date
    • Thread