Re: #pragma message(). Was 'AliasRecord'...
Re: #pragma message(). Was 'AliasRecord'...
- Subject: Re: #pragma message(). Was 'AliasRecord'...
- From: Chris Espinosa <email@hidden>
- Date: Fri, 20 Jan 2006 08:25:49 -0800
On Jan 20, 2006, at 5:46 AM, Jerry Krinock wrote:
on 06/01/19 12:12, Fritz Anderson at email@hidden wrote:
There is no #pragma message() in GCC. Place a #warning directive,
with whatever text you like, where you'd use #pragma message().
Fritz, I still don't know where you find this documentation, but thank
you.
It works.
Now, I have a more difficult challenge. Eric's #if seems like it never
fires regardless of MAC_OS_X_DEPLOYMENT_TARGET, so I'd like to log what
those macros are defined to. In CodeWarrior, somone taught me how to
do
this it as shown below. This may not be possible with #warning, since
#warning seems to just take whatever is on the rest of the line
literally;
it does not use quotes or parentheses. Can anyone show me how to do
this:
#define STRINGIFIER(theString) #theString
#define VALUE_OF(theString) STRINGIFIER(theString)
// Examples of using these:
// Demo, with a user-defined macro
#define MY_DEMO_MACRO 7
#pragma message( "The value of MY_DEMO_MACRO is " VALUE_OF(
MY_DEMO_MACRO )
)
// Demo, with an built-in macro
#pragma message( "The CodeWarrior version is " VALUE_OF( __MWERKS__ ) )
// Demo, with a nonexisting macro
#pragma message( "The value of an undefined macro is itself: "
VALUE_OF(
THIS_MACRO_HAS_NOT_BEEN_DEFINED ) )
Jerry Krinock
An easier way to achieve this is the following:
- Open the Target that builds your file, and open its Compile Sources
build phase
- Select your source file in that build phase and choose Get Info
- Click the Build tab and enter -dD into the "Other C Flags"
- Close the inspector
- Choose "Preprocess" from the Build menu
That will show you the preprocessed source file with macro definitions
in place, without having to edit the source or add nonstandard macros
and pragmas.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden