Compiling with warnings enabled


#1

Hi Jules,

I tend to build all my sources with the -Wall -W flags in order to enable the standard g++ warning. However with juce sources it tends to generate a lot of warnings , especially the “dereferencing type-punned pointer will break strict-aliasing rules” ones in juce_Atomic.h and a few others (that generally seem quite harmless). Do you disable these gcc warnings on purpose ?


#2

Yeah, there were a few places, like atomics, where the code was correct, but I couldn’t find a way to avoid the warnings. Ideally, I’d prefer to have disabled them only for those places, but unlike MSVC, gcc doesn’t let you use pragmas to turn them on or off… So rather than listen to people moaning about the warnings, I had to disable them altogether!


#3

You can change the command line for that specific file compilation.
But concerning the Atomic warning pragma, you actually need to use union to avoid gcc type punning. If you keep your mail, you can have a look to the video component I’ve sent you a while ago, in the Atomic float class, you’ve an example that compiles without warning on both GCC and Win32