Are global Arrays (and other JUCE objects) allowed?


#1

Is it allowed to use an Array as global object in a file? Or can this cause trouble, because for instance, JUCE has not initialised yet?
Might be a dumb question, but I’m having a very weird problem here…

for example:

#include “juce.h”

Array<MyObject*> myObjects; // my global array

… // rest of source code

Would this code be ok?


#2

Yes, you’d be able to get away with that. I think I use a few static VoidArrays occasionally. It’s not a great idea though, better to avoid that kind of thing if possible.