I’m pretty sure there was a good reason why I did that, but the class is quite a few years old now, and I can’t remember what it was… It was probably to avoid some kind of conflict/ambiguity somewhere, though it might well no longer be needed.
Possibly a fair point but that was just an example, I’m actually returning an unsigned long from a function. With or without the U suffix, Xcode (at least) complains that setColour() doesn’t take an ‘unsigned int’ as an argument.
The point is (I think) that you’d need to write:
…rather than simply
If the declaration
was simply:
you could just call:
and the Colour constructor would be called implicitly (a bit like using a C string where Juce expects a Juce String and more recently a MidiMessage where a MidiBuffer is expected). The ‘explicit’ keyword means the constructor will not be called implicitly.
But as Jules says, he probably had some reason for it which may or may not still be a problem. Often this is where there are ambiguities arising from overloaded functions.