跳到正文

算法·理论

史上最短头文件

hat_factory约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月20日
篇幅
约 1 分钟

版本

  1. v1当前

这是c++里最短的头文件:crtdefs.h。

代码只有 1212 行,有用的代码更是只有 44 行,剩下的不是空行就是注释。

以下是源码:

C++
/**
 * This file has no copyright assigned and is placed in the Public Domain.
 * This file is part of the mingw-w64 runtime package.
 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 */

#ifndef _INC_CRTDEFS
#define _INC_CRTDEFS

#include <corecrt.h>

#endif /* _INC_CRTDEFS */

上面的注释翻译:

代码
本文件未分配任何版权,已放入公有领域。
本文件是 mingw-w64 运行时包的一部分
不提供任何担保;请参阅此包中的 DISCLAIMER.PD 文件。

所以大家有空一定要去翻一翻头文件,会有很多好东西的(比如int32_t,int_fast32_t,int least32_t都是int

原文