I suppose additional error information have to be given as return values? > `proc p(args): T {.raises: ErrorCode.}` is translated to `proc p(args): > (ErrorCode, T)` when T is an integral type (int etc.). [...] This seems to > produce the best code for the common architectures (x86, x86_64, ARM, RISC > V). The errors are propagated through CPU registers.
For Windows x64 at most 64-bit structs may be returned via registers (which is easily hit as 64-bit integers are default in Nim). See <https://godbolt.org/z/vKGoGxGrn> The same gose for 32-bit ARM except that it is only 32-bit. See <https://godbolt.org/z/96W1oEvMK> For both cases there are exceptions. E.g. on 32-bit ARM a 64-bit integer or vector may be returned in two registers <https://godbolt.org/z/MqMWeYr47> and for Windows x64 a 128-bit vector may be returned in an SSE register.