• 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: A simple preprocessor question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A simple preprocessor question


  • Subject: Re: A simple preprocessor question
  • From: Shamyl Zakariya <email@hidden>
  • Date: Tue, 20 Mar 2007 13:48:21 -0400

Having just received Rick's reply after sending my message, I see how to make it work. I am surprised what it *used* to work. I don't believe I ever manually added a DEBUG preprocessor macro, but honestly it's easy to forget this stuff. Maybe I did, long ago...

Manually adding the macro works, and I'm able to get back to tracking down an odd GL error.

email@hidden
    "the electrodes of progress on the nipples of ignorance"
        -- Dr. Rick Solomon


On Mar 20, 2007, at 1:39 PM, Shamyl Zakariya wrote:

In fact, I just saw the glError macro in the FBOBunnies samplecode on developer.apple.com -- it seems legitimate, so I can't help but wonder why it's not working for me. Is there some project setting I accidently obliterated which causes that preprocessor macro to be defined?

http://developer.apple.com/samplecode/FBOBunnies/listing1.html

( The author of that demo is a poster on idevgames, and I got the glError macro from him )


email@hidden "time to barf a rainbow"



On Mar 20, 2007, at 1:29 PM, Shamyl Zakariya wrote:

In that case, is there any preprocessor constant that *is* defined when building a debug executable ( that isn't when building a release )?

email@hidden


On Mar 20, 2007, at 1:22 PM, alex wrote:

DEBUG must not be defined.

#ifndef DEBUG
#error "DEBUG not defined"
#endif

alex

At 1:17 PM -0400 3/20/07, Shamyl Zakariya wrote:
I have a framework ( wrapping some base opengl functionality ) which defines a macro which (in a debug build) queries for OpenGL errors, and in a release build does nothing -- since querying for GL errors is runtime expensive.

The macro looks like this:

#if DEBUG
#define glError() { \
GLenum err = glGetError(); \
while (err != GL_NO_ERROR) { \
printf("glError: %s caught at %s:%u\n", (char *)gluErrorString (err), __FILE__, __LINE__); \
err = glGetError(); \
} \
}
#else
#define glError() ;
#endif


As far as I can tell, this used to work. In debug builds, the macro expanded and would query for runtime errors. And in release builds, it went away and my code ran quickly, like it should.

Now, at some recent point ( I can't say exactly when ) it began to follow the #else path in both debug and release builds. I assume I'm using the wrong preprocessor directive... so can anybody tell me how better to bracket this?

email@hidden


_______________________________________________ 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


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40zakariya.net


This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40zakariya.net


This email sent to email@hidden

_______________________________________________ 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
References: 
 >A simple preprocessor question (From: Shamyl Zakariya <email@hidden>)
 >Re: A simple preprocessor question (From: alex <email@hidden>)
 >Re: A simple preprocessor question (From: Shamyl Zakariya <email@hidden>)
 >Re: A simple preprocessor question (From: Shamyl Zakariya <email@hidden>)

  • Prev by Date: Re: A simple preprocessor question
  • Next by Date: Re: executable iostream in terminal when double-clicking app icon
  • Previous by thread: Re: A simple preprocessor question
  • Next by thread: Re: A simple preprocessor question
  • Index(es):
    • Date
    • Thread