3 ms·
one example of good use of globals is for very light-weight pub/sub, where you keep the rule that only one place can write to the global (preferably with someth
by p_l 7y ago
one example of good use of globals is for very light-weight pub/sub, where you keep the rule that only one place can write to the global (preferably with something like atomic write) and any other place only reads.
- DubiousPusher 7y agoI use this kind of blackboard system still when I can't avoid globals. The main thing it helps with I find is you still have to know the order of and when your systems are being setup. Ran into so many bugs from people creating static instance globals and thinking it was good that they didn't have to care when systems were setup. I hate create on access with a passion. For god sake just new the damn thing at the beginning of main if nowhen else.