Skip to content

Instantly share code, notes, and snippets.

@namazso
namazso / SuperReturn.c
Last active July 31, 2025 15:11
SuperReturn
/// Return, but across multiple frames.
///
/// This function unwinds the given number of frames, then sets the return value provided, emulating as if this number
/// of functions returned, with the last one returning the value provided in RetVal. Can be used to hook a callee when
/// you don't have a convenient way to hook it directly and actually just want to stub it out with a return value.
///
/// @param FramesToSkip The number of frames to skip, starting from the current frame.
/// @param RetVal The value to return from the last frame.
/// @param Context Context to start from, in case you want to SuperReturn from somewhere deeper.
DECLSPEC_NOINLINE void SuperReturn(
@olibre
olibre / cpp_legacy_inheritance_vs_std_variant.md
Last active June 6, 2025 07:27 — forked from GuillaumeDua/cpp_legacy_inheritance_vs_std_variant.md
C++ legacy inheritance vs CRTP + std::variant