B.0 General
An implementation shall be able to translate and execute at least one program that meets every limit in clause B.1 simultaneously.
An implementation should impose no fixed limit at all, and should be bounded only by available storage. Where a fixed limit exists, the implementation shall document it, and shall produce a diagnostic naming the limit when a program exceeds it. Silently truncating, wrapping, or miscompiling a program that exceeds a limit is not conforming behavior.
The values below are minimums. They are raised from the ISO C99 values, because the ISO values describe machines that no longer translate anything.
B.1 Translation Limits
| Limit | Minimum |
|---|---|
| Nesting levels of blocks | 256 |
| Nesting levels of conditional inclusion | 256 |
| Pointer, array, and function declarators modifying a type | 32 |
| Nesting levels of parenthesized declarators | 128 |
| Nesting levels of parenthesized expressions | 256 |
| Significant initial characters in an internal identifier or macro name | 1024 |
| Significant initial characters in an external identifier | 1024 |
| External identifiers in one translation unit | 65535 |
| Identifiers with block scope declared in one block | 4095 |
| Macro identifiers simultaneously defined in one translation unit | 65535 |
| Parameters in one function definition | 256 |
| Arguments in one function call | 256 |
| Parameters in one macro definition | 256 |
| Arguments in one macro invocation | 256 |
| Characters in one logical source line | 65535 |
| Characters in a string literal, after concatenation | 65535 |
| Bytes in one object | 1048576 |
Nesting levels for #include files |
128 |
case labels in one switch, excluding nested switches |
8191 |
| Members in one structure or union | 8191 |
| Enumeration constants in one enumeration | 8191 |
| Nesting levels of structure or union definitions in one declaration list | 128 |
Nesting levels of typedef chains |
64 |
Significant characters in identifiers.
An implementation shall treat at least 1024 initial characters as significant for both internal and external identifiers, and shall treat case as significant in both.
Difference: ISO C99 requires only 31 significant characters for an external identifier and permits case to be ignored there. That allowance described linkers that no longer exist, and it made two distinct identifiers silently the same entity. Ocean Edition I removes it.
B.2 Numerical Limits
B.2.1 Integer types
<limits.h> shall define the macros listed in clause 7.2.8. The following values are fixed in every implementation:
CHAR_BIT 8
CHAR_MIN 0
CHAR_MAX 255
UCHAR_MAX 255
SCHAR_MIN -128
SCHAR_MAX 127
For every other signed integer type of width N, the minimum and maximum are exactly:
minimum -2^(N-1)
maximum 2^(N-1) - 1
For every unsigned integer type of width N, the maximum is exactly 2^N - 1.
Minimum widths, which the selected data model may exceed:
| Type | Minimum width |
|---|---|
char, signed char, unsigned char |
8 |
short, unsigned short |
16 |
int, unsigned int |
16 |
long, unsigned long |
32 |
long long, unsigned long long |
64 |
An implementation targeting a hosted environment should provide an int of at least 32 bits. The 16-bit minimum is retained only for freestanding targets where a wider int would be a real cost rather than a preference.
Difference: ISO C99 permits INT_MIN to be -32767 rather than -32768, so that sign-magnitude and ones-complement machines could conform. Two's complement is required here, so the extra value always exists and shall be reported.
B.2.2 Exact-width types
Where the target has an integer type of width 8, 16, 32, or 64, the implementation shall provide the corresponding exact-width types of clause 7.2.20. Because there are no padding bits, an exact-width type exists whenever a type of that width exists.
B.2.3 Floating types
<float.h> shall define the macros listed in clause 7.2.5. Minimum requirements:
| Macro | Minimum magnitude |
|---|---|
FLT_RADIX |
2 |
FLT_MANT_DIG |
24 |
FLT_DIG |
6 |
FLT_MIN_10_EXP |
-37 |
FLT_MAX_10_EXP |
+37 |
FLT_MAX |
1E+37 |
FLT_MIN |
1E-37 |
FLT_EPSILON |
1E-5 |
DBL_MANT_DIG |
53 |
DBL_DIG |
10 |
DBL_MIN_10_EXP |
-37 |
DBL_MAX_10_EXP |
+37 |
DBL_MAX |
1E+37 |
DBL_MIN |
1E-37 |
DBL_EPSILON |
1E-9 |
LDBL_MANT_DIG |
53 |
LDBL_DIG |
10 |
An implementation should map float to IEC 60559 binary32 and double to binary64 wherever the target supports them.
B.3 Library Limits
| Limit | Minimum |
|---|---|
Functions registerable with atexit |
32 |
Simultaneously open files, FOPEN_MAX |
8 |
Characters in a file name, FILENAME_MAX |
260 |
Distinct temporary file names, TMP_MAX |
25 |
Bytes in a multibyte character, MB_LEN_MAX |
4 |
Signals distinguished by <signal.h> |
6 |
Characters produced by one printf conversion |
4095 |
MB_LEN_MAX is at least 4 because UTF-8 is the default execution character set and a UTF-8 sequence occupies up to four bytes.
B.4 Recommended Practice
An implementation should replace every fixed limit with a limit derived from available storage, and should report exhaustion as a diagnostic that names the resource. A program that fails to translate should never fail silently, and should never translate into something other than what it says.