In order to ensure that some initialization code runs before main (using Arduino/avr-gcc) I have code such as the following:
main
class Init { public
Your solution in simple and clean. What you can additionally do is to put your code in anonymous namespace. I don't see any need to make it better than that :)