News for hackers. Stuff that matters.
Re:Some were meant for C [pdf] by kazinator on Thursday June 22, 2023 @01:05AM (#36428186)
What's the difference, between a function with multiple entry points, and several very similar functions? Sharing of instructions for a more compact image? That could be a compiler optimization.

A work around would be to put most of the body into a macro which is expanded into multiple functions that have alternative entry means.

C returns multiple values via structs; e.g. see the standard library functions div and ldiv.

Coroutines can be hacked in C. I've hacked delimited continuations in C; they work by copying sections of the stack out to a heap-allocated object, which is restored to the current stack top when the continuation is resumed.

Hacking coroutines in C was a popular sport in the 1980's and 90's.

Exception handling can be implemented in C. I wrote a library for that a quarter century ago; it is used in Wireshark. More recently I created a Lisp language which has exception handling; it's rooted in the C one.

There are no comments on this comment yet.