|
The pseudo-random number function magic() needs to be primed via
magic_init() before being invoked. The standard (but klunky) way
of handling this is with a static bool inside the function which
indicates whether initialization has happened, and if not, handles
initialization and then sets the flag.
Sometimes it's more desireable to have initialization happen in
a known order before program execution starts (this helps with
reproducibility). We can do this by indicating to the compiler/
linker that particular functions need to be executed after __start()
but before main().
|