authorgravatar for felix@rabe.ioFelix Rabe <felix@rabe.io> 2025-05-30 03:11:00+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-05-30 01:11:00+00:00
log561ab59ceccb18c8a26b91292cf034556c6b0e4d
tree08f7f8a699bfa5d630bbacbbd0022d91227793cd
parent4641e9556d1343e95e4676e2f1e3024173db9962
signaturebadge-check Signed by PGP key B5690EEEBB952194

langref: Update calling convention (#24022)

* langref: Update calling convention * Apply suggestions from code review Co-authored-by: Alex Rønne Petersen <alex@alexrp.com> * langref: Just use .winapi directly --------- Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

1 files changed, 1 insertions(+), 2 deletions(-)

doc/langref/test_functions.zig+1-2
...@@ -23,8 +23,7 @@ export fn sub(a: i8, b: i8) i8 {...@@ -23,8 +23,7 @@ export fn sub(a: i8, b: i8) i8 {
23// dynamically. The quoted identifier after the extern keyword specifies23// dynamically. The quoted identifier after the extern keyword specifies
24// the library that has the function. (e.g. "c" -> libc.so)24// the library that has the function. (e.g. "c" -> libc.so)
25// The callconv specifier changes the calling convention of the function.25// The callconv specifier changes the calling convention of the function.
26const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .Stdcall else .C;26extern "kernel32" fn ExitProcess(exit_code: u32) callconv(.winapi) noreturn;
27extern "kernel32" fn ExitProcess(exit_code: u32) callconv(WINAPI) noreturn;
28extern "c" fn atan2(a: f64, b: f64) f64;27extern "c" fn atan2(a: f64, b: f64) f64;
2928
30// The @branchHint builtin can be used to tell the optimizer that a function is rarely called ("cold").29// The @branchHint builtin can be used to tell the optimizer that a function is rarely called ("cold").