[riot-devel] RIOT and static initializers in C++

Hiesgen, Raphael Raphael.Hiesgen at haw-hamburg.de
Fri Sep 19 17:15:00 CEST 2014


static initializers don’t seem to work on RIOT. Setting a breakpoint in the constructor reveals, that it is never called. I believe the static initialization should occur before calling main. If I am not mistaken, RIOT calls the function startup before the main.

I attached an example program [1]. To try it on RIOT, copy the code into the cpp example. If foo is initialized correctly, data should be set to 1. However, the example prints 0.

Usually the compiler should take care of the initialization. Does someone know why this initialization does not happen on RIOT? 

Thank you

[1] https://gist.github.com/josephnoir/c948b78bf586ae4fa361

More information about the devel mailing list