That reminds me of the time I saw a C# database save function looking at the stack trace to figure out if it had already been called, exiting if it saw itself on the stack.
I mean, it's not wrong, but it is crazy.
If I recall, I once did something like this in Python that modified variables in its caller. Not for production, just for shits and giggles :D
Interesting problem - what's the shortest C function that takes a pointer to bytes and returns the length of the x86-64 instruction there? (and how many hours would it take to code it)