...
Implementations conforming to C are required to declare errno
in <errno.h>
, although some historic implementations failed to do so.
Exceptions
DCL37-EX1EX0: It is permissible to use reserved words in declarations when the risk of clashing with a preexisting variable is greater than the risk of clashing with a reserved word. In particular, the scope must be used in a macro that may be invoked with arbitrary preexisting variables (possibly as arguments). The following code demonstrates a SWAP_UNSAFE()
macro that exchanges two values, and uses a __tmp
variable as a temporary value. This code is permitted because the temporary variable is more likely to clash with a nonreserved variable in the current scope than with a reserved word. This code should be considered nonportable because it requires the current platform to allow the use of __tmp
.
Code Block | ||||
---|---|---|---|---|
| ||||
#define SWAP_UNSAFE(type, a, b) do { type __tmp = a; a = b; b = __tmp; } while(0) |
Such macros should be used only with great care. See PRE31-C. Avoid side effects in arguments to unsafe macros and PRE00-C. Prefer inline or static functions to function-like macros for more information.
DCL37-EX2EX1: Provided that a library function can be declared without reference to any type defined in a header, it is permissible to declare that function without including its header as long as that declaration is compatible with the standard declaration.
...