>Yeah I don't have a problem with that kind of stuff as long as its portable
>and you keep the code short.
-----
And it is well commented/documented.
John W.
On Thursday, December 13, 2018, 3:06:02 PM EST, John R. Hogerhuis
<[email protected]> wrote:
On Thu, Dec 13, 2018 at 10:01 AM Scott Lawrence <[email protected]> wrote:
On Mon, Dec 10, 2018 at 1:21 PM John R. Hogerhuis <[email protected]> wrote:
In other languages you can't call into the middle of a function. There is one
entry point, possibly multiple exit points. There's no chance unbalanced CALL
and RETURN. once you return you're jump to the stacked address and you're no
longer in the subroutine.
For what it's worth, you certainly can do this in C. ...And it woks fine if
the place you jump to is in a function with the same size/number of parameters
passed in (pushed onto the stack). Although optimizations that the compiler
does might screw with that. ;)
Fair enough. I've seen setjmp/longjmp. It's really weird. I ran across it in
some code creating its own scheduler for a network simulator unit test harness.
Basically it needed to create multiple instances of a protocol stack to test a
IoT mesh network. Is setjmp/longjmp what you're talking about? Because I don't
think you can goto or call into the middle of a function otherwise.
By no means is it recommended or even slightly good practice though. ;D
A somewhat similar weird goto-thing is Duff's Device, where you jump into the
middle of a loop... https://en.wikipedia.org/wiki/Duff%27s_device
Yeah I don't have a problem with that kind of stuff as long as its portable and
you keep the code short. -- John.