F
Frank
Before I start, please let's not discuss whether goto is evil or not.
For generated code, this can make perfect sense.
It would be interesting to know a trick how to get C to do a goto to
an address that has been assigned to a variable, i.e.
MyLabel:
....
address_x = MyLabel;
....
goto address_x;
I tried to pack the positions into a switch statement and made
'address_x' a variable of type 'enum', such as
enum { Label1, Label2, Label3, ... } address_x;
GotoStartPoint:
switch( address_x ) {
case Label1: ...
case Label2: ...
case Label3: ...
}
....
address_x = Label2;
goto GotoStartPoint;
But when I look at the assembler code, it is not as efficient as a
jump to an address assigned to a variable.
Is there any way to get arround that?
Best Regards
Frank
For generated code, this can make perfect sense.
It would be interesting to know a trick how to get C to do a goto to
an address that has been assigned to a variable, i.e.
MyLabel:
....
address_x = MyLabel;
....
goto address_x;
I tried to pack the positions into a switch statement and made
'address_x' a variable of type 'enum', such as
enum { Label1, Label2, Label3, ... } address_x;
GotoStartPoint:
switch( address_x ) {
case Label1: ...
case Label2: ...
case Label3: ...
}
....
address_x = Label2;
goto GotoStartPoint;
But when I look at the assembler code, it is not as efficient as a
jump to an address assigned to a variable.
Is there any way to get arround that?
Best Regards
Frank