Standard C++ Library Reference ISO/IEC (VERSION3)
C Library Conventions
A library macro that masks a function declaration expands to an expression that evaluates each
of its arguments once (and only once). Arguments that have side effects evaluate the same way
whether the expression executes the macro expansion or calls the function. Macros for the
functions getc and putc are explicit exceptions to this rule. Their stream arguments can be
evaluated more than once. Avoid argument expressions that have side effects with these
macros.
A library function that alters a value stored in memory assumes that the function accesses no
other objects that overlap the object whose stored value it alters. You cannot depend on
consistent behavior from a library function that accesses and alters the same storage via
different arguments. The function memmove is an explicit exception to this rule. Its arguments
can point at objects that overlap.
An implementation has a set of reserved names that it can use for its own purposes. All the
library names described in this document are, of course, reserved for the library. Don't define
macros with the same names. Don't try to supply your own definition of a library function,
unless this document explicitly says you can (only in C++). An unauthorized replacement may
be successful on some implementations and not on others. Names that begin with two
underscores (or contain two successive underscores, in C++), such as __STDIO, and names
that begin with an underscore followed by an upper case letter, such as _Entry, can be used as
macro names, whether or not a translation unit explicitly includes any standard headers. Names
that begin with an underscore can be defined with external linkage. Avoid writing such names
in a program that you wish to keep maximally portable.
Some library functions operate on C strings, or pointers to null-terminated strings. You
designate a C string that can be altered by an argument expression that has type pointer to char
(or type array of char, which converts to pointer to char in an argument expression). You
designate a C string that cannot be altered by an argument expression that has type pointer to
const char (or type const array of char). In any case, the value of the expression is the address
of the first byte in an array object. The first successive element of the array that has a null
character stored in it marks the end of the C string.
A filename is a string whose contents meet the requirements of the target environment
for naming files.
●
A multibyte string is composed of zero or more multibyte characters, followed by a null
character.
●
A wide-character string is composed of zero or more wide characters (stored in an array
of wchar_t), followed by a null wide character.
●
If an argument to a library function has a pointer type, then the value of the argument
expression must be a valid address for an object of its type. This is true even if the library
function has no need to access an object by using the pointer argument. An explicit exception is