Using goto instead void calls.

I am thinking this method to avoid a lot void calls that results variables must be saved outside void setup, void loop, and other calls functions which leads bigger program size.

F.ex:
loop()
{
// code here

"call" a function inside loop instead void call(); but with number variable to return to correct
position with if else if as void function would do.
code with if else if to using goto to go to correct position with value before function.
<- goto pass_fake_void_function;
| trigonometry:
| Doing calculation square root
| // square root calculation
| // then
| if ( value == 1 ) { goto value1; } else if ( value == 2 ) { goto value2; }
| }
| value1: ;
-> pass_fake_void_function: ;
//loop go as normal....
if several function call
value = 2;
goto trigonometry;
value2: ;

Do you understood?

Did you understand the C-language switch construct?
Why do you want to develop a goto based replacement?

BTW: Using functions (if not used for clarity only) most often leads to smaller code.

You asking me this question, then prove me an example of switch construct.
You did not mention where to put switchCase.

Let's start with a compiling example of your version.

OK, I will try.

In effect, you have created an indexed return stack. It is hampered by the need to associate multiple return points with arbitrary numbers. It has the overhead of having to test the numbers, to match the correct return point. This cancels out any gain that you might have made from not having to place return addresses on the stack and pull them off (which is automatic on most processors). Note that you are not required to pass and return parameters from a function. You can use global variables. It is just convenient and aligns well with a lot of fundamental design approaches, to pass and return parameters..

value = 2;
    goto trigonometry;
    value2: ;

is like the processor level actions that go with a subroutine call:

save return address
load the sub address into the program counter

but the processor does that faster than your code.
Close, but no cigar.

Begraphics:
to avoid a lot void calls that results variables must be saved outside void setup, void loop, and other calls functions which leads bigger program size.

The size of storage space for variables is unlikely to be reduced by the use of GOTO whereas the tangles in your code will grow exponentially.

Just use functions.

...R

It is able to define the function as naked ( attribute ((naked)) ) in avr-gcc. Compiler doesn't provide any prolog and epilog for such function - save/restore the registers. In C it is still function, in result it is replaced by jump.
Maybe this helps.

Budvar10:
It is able to define the function as naked ( attribute ((naked)) ) in avr-gcc. Compiler doesn't provide any prolog and epilog for such function - save/restore the registers. In C it is still function, in result it is replaced by jump.
Maybe this helps.

I doubt it. A jump would be the result of a goto.

Also, I wonder if the optimizer doesn't already remove all the overhead automatically when a function is a void f(void);

aarg:
I doubt it. A jump would be the result of a goto.

Also, I wonder if the optimizer doesn't already remove all the overhead automatically when a function is a void f(void);

Yes, I wondering that too about the optimizer.
That's the reason I started this topic.