我正在查看gcc属性列表,发现了一个引起注意的属性:
nothrow
The nothrow attribute is used to inform the compiler that a function cannot
throw an exception. For example, most functions in the standard C library can be
guaranteed not to throw an exception with the notable exceptions of qsort and
bsearch that take function pointer arguments. The nothrow attribute is not
implemented in GCC versions earlier than 3.3.
一个C函数如何抛出异常?有人能解释一下这个属性的用途吗?
似乎有一个可用的nothrow
标签,但我发现它似乎与C++ std::nothrow
相关。不确定是否与我的问题相关。
int dd(int x, int y) { if (!y) return 0; return x/y; }
- pmg