On Thu, Jul 20, 2023 at 3:28 PM Greg Wooledge <g...@wooledge.org> wrote:

>
> The idea that this would "work" is quite surprising to me.  The basic
> idea of a function is that it does stuff and then returns you to the
> point where you were when the function was called.
>
>
Really ?


> In other languages, would you expect that you might call a function,
> and have that function reach upward through the call stack and manipulate
> your control flow?


To name a few :-)
In C longjmp() lands you anywhere on the the call path.
Any try/catch language will do it too

In C family there are even function that never return (see noreturn
function attribute)

FORTRAN alternate return is fun too.

Not counting assembly where you can land anywhere with a ret *reg

Basically this is hacker day to day job to return anywhere unexpected :-)

Reply via email to