Hello Justin,
BCS wrote:
Hello Justin,
Yes, well, that unfortunately is what I'm doing in my C++ project ..
putting implementation of all the static class declarations in one
big file.
could you do that same sort of things that you do with .h files?
Sorry, I'm not sure I understand your question. For my problem, .h
files are not the issue; the issue is about establishing the correct
order for statically constructed objects which exist in .cpp files.
Hence the reason for one big .cpp file.
I'm suggesting that a variation on the idea of scope guards be used: if static
initializer A depends on static initializer B having been run, than at the
top of A, it calls B. Then to prevent both of them from being called more
than once, you put in a short-circuit return at the top based on a function-local
static bool and (optionally) a check to see if the function is getting called
in a loop. Than you make shure that every static inilizer gets called at
least once and the order sort's its self out.
I don't remember exactly how static initializers are setup in C++ so you
might have to put the above in extra functions that get called from the static
initializers.
--
<IXOYE><