From clc-wiki
This page comprehensively lists all non-portable identifiers used in the reference implementations of standard functions and headers on this wiki, including types, variable names, macros and functions; it also lists identifiers that encapsulate inconsistencies between versions of the Standard. The purpose of each identifier is described on this page if it is used in multiple places, otherwise it is described on the page where it is used.
Naming conventions
Identifiers on this page are prefixed with underscores and the letters "nc" (for not consistent) or "np" (for not portable). Macros are capitalised and begin with a single underscore: _NC_
or _NP_
. Other identifiers, even if they might be implemented as a macro, are lowercase and begin with a double underscore: __nc_
or __np_
.
Abstractions for inconsistency
The identifiers in this section encapsulate inconsistencies between versions of the Standard and use the prefix characters "nc" according to the convention described above.
_NC_RESTRICT
A macro expanding to the token restrict
on an implementation that supports the restrict keyword (C99 and above) and explicitly undefined on an implementation that does not. A portable way to define this macro is:
#ifdef __STDC_VERSION__ # if __STDC_VERSION__ >= 199901L /* C99 or later */ # define _NC_RESTRICT restrict # else # define _NC_RESTRICT # endif #else # define _NC_RESTRICT #endif
but note that this depends on __STDC_VERSION__
being already defined to an appropriate value. If you are inserting this code into an existing implementation, __STDC_VERSION__
should already be set appropriately; if you are creating a new implementation (library + compiler) then you will need to ensure that this macro is set by whichever means is appropriate - possibly by including a custom header - or rewrite it to rely on some non-portable indicator of which version of the Standard your implementation complies to.
Also note that legally a C90 compiler could set __STDC_VERSION__
to a value greater than 199409L, which would break the above code; the likelihood of this is debatable.
Used in:
Abstractions for non-portability
The identifiers in this section encapsulate platform-specific code used in otherwise portable implementations of standard library functions and headers elsewhere on this wiki. The prefix characters "nc" are used according to the convention described above. Possible implementations are included where they provide useful insight, but they are necessarily non-portable and beyond the focus of this wiki.
__np_size_t
This identifier is an alias for the size_t type. It should be typedef'd to the type that the implementation will use for returning object sizes through the sizeof() operator. Used in:
__np_anyptrlt
Used in: