Elektrine lite

← Feed

@pmmeurcatpics@ieji.de

Post #2551723

2026-04-16 06:58 UTC

@zwarich@hachyderm.io @nnethercote@mas.to which C++isms? 👀

Replies (1)

  • @zwarich@hachyderm.io 2026-04-16 14:56

    @pmmeurcatpics@ieji.de @nnethercote@mas.to There is a long trail of historical baggage, probably starting with the interactions between unprototyped functions and varargs. Because varargs make callee cleanup of the stack impossible, C calling conventions typically require caller cleanup of the stack, which is obviously incompatible with tail calls. There are some exceptions in the C world, which are mostly inspired by alternate Pascal traditions. The x86 ISA is actually biased towards a Pascal calling convention with callee cleanup, e.g. ENTER/LEAVE for nested procedures and RET taking an optional stack adjustment. You can get slightly smaller code size by leaning into the Pascalisms, For example, the Win32 calling convention is a Pascal-style one called `stdcall`, and LLVM has support for it, but just for x86. Rust could have also decided to add their own calling convention that always supports tail calls (like GHC or HiPE), but then they would have needed to maintain backend code for all of the targets they want to support (and deal with FFI ABI mismatches themselves).

    Open ##2551724