Addition: here's probably how I would implement it given how you
described it and if I wanted to be quick about it. Of course some
pointer massaging may be in order if you're not in a memory model
where routine pointers and variable pointers are compatible.
-------------------------------------------------------------------------------------------------------
class init_vars {
// all your initialization variables. No pointers please.
// with an appropriate assignment operator.
};
const init_vars *init=(init_vars *)initialization_routine;
void initialization_routine() {
init_var *tmpvars=new(init_vars);
// do initialization stuff
// add noops here if necessary to pad the routine to sizeof(init_vars)
*init=*tmpvars;
delete tmpvars;
}
void end_of_initialization_routine() {} // for ease of calculating the size
// of the
initialization routine.