>>16What we have currently
void* ret=Global_ret1;
goto sub1;
Global_ret1:
ret=Global_ret2;
goto sub1;
Global_ret2:
sub1:
do_something();
goto ret;(non-standard computed goto)
//or Global_retX is a variable
if(ret==Global_ret1)goto Global_ret1;
if(ret==Global_ret2)goto Global_ret2;
Instead we could have
sub1();//goto sub1
//implicitly returns here(after gosub)
sub1();//goto sub1
//implicitly returns here(after gosub)
sub1();//goto sub1
//implicitly returns here(after gosub)
sub1:{
do_something();
return;(to place after sub1())
}
or
inline sub1:{ code_inserted at place of invocation}
It will be
1.less code size than inlining the subroutine
2.extremely fast due no function calls(only 2 jmps)
3.allow access to all global/local variables.
4.if you specify inline it could be inserted entirely without any goto(2 jmps saved)
Currently there is only a macro
#define always_inlined_subroutine(a,b) ({code_inserted_each_time macro is invoked;returns value ;})