diff options
author | Mole Shang <[email protected]> | 2025-03-30 16:37:23 +0100 |
---|---|---|
committer | Mole Shang <[email protected]> | 2025-03-30 16:37:23 +0100 |
commit | 8dcf8d2cc965ac6874c69d1e9bbe18a855eac360 (patch) | |
tree | 4eeb6abf1c73e008cad47e528074cadf18690b45 /content/mingw-code-golfing-quirks | |
parent | 654a480cec92afe212ab88de504706605c7a5be8 (diff) | |
download | zola-blog-8dcf8d2cc965ac6874c69d1e9bbe18a855eac360.tar.gz zola-blog-8dcf8d2cc965ac6874c69d1e9bbe18a855eac360.tar.bz2 zola-blog-8dcf8d2cc965ac6874c69d1e9bbe18a855eac360.zip |
mingw-code-golfing-quirks: add godbolt link
Diffstat (limited to 'content/mingw-code-golfing-quirks')
-rw-r--r-- | content/mingw-code-golfing-quirks/index.md | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/content/mingw-code-golfing-quirks/index.md b/content/mingw-code-golfing-quirks/index.md index d7e8ff5..07ab6d4 100644 --- a/content/mingw-code-golfing-quirks/index.md +++ b/content/mingw-code-golfing-quirks/index.md @@ -65,4 +65,6 @@ GCC 文档如此解释 `no-builtin` 选项: 显然我们在没有函数签名定义的情况下,又开启了 `no-builtin` 选项,编译器因而无从获取 `printf` 的签名信息,只能从调用推断其签名为 `void printf(const char*, double)`,无法遵循正确的 `varargs` 调用规范设置通用寄存器 `$rdx`,导致 Windows 运行时标准库中的 `printf` 作为 callee 获取第二个参数时永远是全0(`$rdx` 原值);而一旦关闭这一选项,即使不写签名,编译器也能通过内建的函数匹配机制获得完整的 `printf` 签名信息(`int printf(const char*, ...)`),便能生成正确的汇编调用设置 `$rax`,结果也自然没有问题了。 -C,很奇妙吧。 xDDD
\ No newline at end of file +C,很奇妙吧。 xDDD + +> Compiler Explorer 复现链接: https://godbolt.org/z/eh9WK9eqG
\ No newline at end of file |