我尝试用谷歌搜索它,但所有结果都是关于 C++ 的throw std::exception()。
我正在阅读库(很好奇像printf,malloc和 之类的东西FILE是如何实现的)并发现了该malloc函数的定义:
extern void *malloc (size_t __size) __THROW __attribute_malloc__
__attribute_alloc_size__ ((1)) __wur;
Run Code Online (Sandbox Code Playgroud)
当使用IDE(Visual Studio Code)追溯每个事物的定义时,__THROW导致了这样的情况:
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
// stuff that doesn't happen
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# define __THROWNL throw ()
# define __NTH(fct) __LEAF_ATTR fct throw ()
# define __NTHNL(fct) fct throw ()
// continuation to the …Run Code Online (Sandbox Code Playgroud)