juce_debug

Hi there,

I have just discovered the importance of the JUCE_DEBUG macro, especially when it is set in the juce library and not in your own code ! Since AudioProcessor has an optional member “changingParam” that is added only in juce debug, one may encounter strange behaviours.

Of course, this was my fault, but maybe would it be a good feature to check that one is not trying to link a program compiled without JUCE_DEBUG with a juce lib compiled with JUCE_DEBUG (by using some different names for some functions causing a link error if the debug flag does not match) ? That’s just an idea

On the same topic, I think more control on wether JUCE_DEBUG is set or not would be great. For example on macos it is set if NDEBUG is not defined. But in some situations, I would like to keep my assert (so no NDEBUG), and no JUCE_DEBUG. This is also not completely consistent with the linux part, where JUCE_DEBUG is set if the _DEBUG macro is set (instead of NDEBUG)

Yes, good idea, I’ll see if I can figure out some kind of link check like that.

So are you suggesting having some other macro to override the default way that JUCE_DEBUG is set? That’s easy enough to do, it can go in the juce_Config.h file with the other settings.

Hello Jules,

Yes that would be great. Right now I am just compiling with a -DJUCE_DEBUG=1 on my command line, and that works perfectly for forcing JUCE_DEBUG , but I think I have no similar way of forcing JUCE_DEBUG to be off. Maybe just putting something like

#if JUCE_DEBUG == 0

undef JUCE_DEBUG

#else
all the stuff in juce_PlatformDefs.h
#endif

in juce_PlatformDefs.h would be enough (but not very elegant)

Ok, I’ll add an extra setting, JUCE_FORCE_DEBUG, which you can set to 0 or 1, and that’ll override JUCE_DEBUG