[DiscordArchive] But wait, if I created an init function in each TU and inside the constructors of the register test
[DiscordArchive] But wait, if I created an init function in each TU and inside the constructors of the register test
Archived author: Sovak • Posted: 2022-09-11T17:40:01.439000+00:00
Original source
But wait, if I created an init function in each TU and inside the constructors of the register test global variables id create a side effect that would affect the init function, wouldnt the global variables be forced to be linked in? <@200677690838220800> Or would that be implementation dependent behavior?
Archived author: <o> • Posted: 2022-09-11T17:40:59.819000+00:00
Original source
it's ub and the variables aren't guaranteed to even load before you access them
Archived author: Sovak • Posted: 2022-09-11T17:41:23.002000+00:00
Original source
id access the init function at runtime
Archived author: Sovak • Posted: 2022-09-11T17:41:37.306000+00:00
Original source
for example std::vector<bool> loaded.
Archived author: Sovak • Posted: 2022-09-11T17:42:06.811000+00:00
Original source
ctor: { loaded.push_back(loadtest(suite, name)) }
Archived author: Sovak • Posted: 2022-09-11T17:42:21.315000+00:00
Original source
and then in the init function access loaded vector somehow