Missing #pragma once in juce_Javascript.h

Probably makes little difference, but now it is known!

1 Like

I don’t see a #pragma once in any header file, so I add them manually (probably will be overwritten when there there will be an update).

Is there a better solution to tackle the problem of not allowing double includes of the same file?

The #pragma once is found in every module header, e.g.

You shouldn’t include any other header yourself.
JUCE makes sure the internal headers are only once included in the master header of said module.

I don’t know if it is considered an optimisation. There were many debates about that, because it trips up some IDEs.

1 Like

This is because of the unity build pattern that JUCE uses. One of its core design patterns is that user code should only include the module headers, which have include guards, rather than individual headers which can be seen as a private implementation detail. Most internal juce headers won‘t even build included on their own since they don‘t include other headers they rely on but rely on the module header including the files in the right order.

Edit: @daniel was faster :wink:

1 Like

So I guess I should stopping include <juce_xxx/yyy> headers (I was doing that now, will remove them then). THanks for the explanation!