C语言 如何查看 printf 的实现源代码



我想看看printf(和许多其他函数)是如何工作的。

我写了

#include <Windows.h>
#include <stdio.h>
int main()
{
printf("");
return 0;
}

在 main.c 代码中,然后转到右键单击菜单中的定义

但它显示类似的东西

_Check_return_opt_ _CRTIMP int __cdecl printf(_In_z_ _Printf_format_string_ const char * _Format, ...);
#if __STDC_WANT_SECURE_LIB__
_Check_return_opt_ _CRTIMP int __cdecl printf_s(_In_z_ _Printf_format_string_ const char * _Format, ...);
#endif

我找不到任何关于 printf 如何工作的提示。

任何人都可以告诉我如何学习标准库实现吗?

你来了:

http://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/vfprintf.c;h=d5690342536bc8cf948c786f663bb63f73f91f3a;hb=HEAD。

这是来自GNU C库实现(GLIBC)。

最新更新