Possible to initialize static variable by calling function
c
Solution
When I originally looked at the question, it was tagged both C and C++. The code could be C or C++ because `bool` is a type in C99 and C11, just as it is in C++ (almost; in C, you need the `<stdbool.h>` header to get the name `bool`).
The answers for the two tags are:
In C++, yes.
In C, no.
They are not the same language. If you need a demonstration, this is as good an example as any.
Problem
Is this possible? ``` static bool initialize() { TRC_SCOPE_INIT(...); ... } static bool initialized = initialize(); ``` To make a very long story short, I need to call a series of macros (to initialize debugging messages) as early as possible (before thread X is started, and I don't have the ability to know when thread X is started).