C99 Compliance
From Open Watcom
There is an ongoing effort to improve compliance with the ISO/IEC 9899:1999 standard, also known as C99.
C99 compatibility is an undocumented feature, since the implementation is not complete. Use the -za99 switch to turn on the C99 extensions that are implemented (see below).
Watcom C/C++ version 11.0 already included a number of extensions that were later standardized in C99. That included:
- C++ style comments
- Non-constant initializers for local aggregrates or unions (-aa mode only)
- Commas after last element in enumerator or initializer list
After the Watcom tools were open sourced, many improvements have been made by contributors:
- Variable argument macros (version 1.2, by JimB)
- 64-bit
long longintegers, based on existing__int64support (version 1.2, by BartO) - The
__func__identifier (version 1.2, by MichalN) - The
inlinekeyword, based on existing__inlinesupport (version 1.3, by BartO) - Improved wide char literal support (version 1.3, by BartO)
- Runtime library functions dealing with
long longobjects (version 1.3, by BartO and MichalN) - Designated initializers (version 1.4, by BartO)
- Support for
restrictkeyword (version 1.3, by JimS; -za99 mode only) - Partial support for
_Bool, _Complex, _Imaginarykeywords (version 1.3, by JimS; -za99 mode only) - Wide character memory manipulation routines, ie.
wmemcpy()and friends (version 1.4, by MichalN) - Declarations in for loops and anywhere in compound statements (version 1.5, by MichalN)
- Numerous updates to C library and headers (ongoing work by BartO, JiriM, MichalN, PeterC, and others)
When and if other C99 features will be added depends purely on how much effort contributors want to invest. Some features are fairly esoteric and there appears to be little or no demand for them (eg. complex math). The features most likely to be implemented are the ones that add new functionality that cannot be achieved through other means (eg. hex floating-point constants).
Detailed table:
| change | OW version | notes |
|---|---|---|
| restricted character set support via digraphs and <iso646.h> (originally specified in AMD1) | pre-1.0 | iso646.h is present, but no digraphs. |
| wide character library support in <wchar.h> and <wctype.h> (originally specified in AMD1) | 1.0-1.4 | |
| more precise aliasing rules via effective type | ? | |
| restricted pointers | 1.3 | -za99 only, no effect |
| variable length arrays | - | |
| flexible array members | pre-1.0 | supported as C90 extension |
| static and type qualifiers in parameter array declarators | ? | |
| complex (and imaginary) support in <complex.h> | 1.3 | Header present, but library support far from complete. |
| type-generic math macros in <tgmath.h> | - | |
| the long long int type and library functions | 1.2 and 1.3 | |
| increased minimum translation limits | pre-1.0 | generally no fixed limits in compiler |
| additional floating-point characteristics in <float.h> | 1.4 | |
| remove implicit int | 1.3 | diagnosed via W304, W305 |
| reliable integer division | ? | |
| universal character names (\u and \U) | - | |
| extended identifiers | pre-1.0 | all characters of an identifier are significant |
| hexadecimal floating-point constants and %a and %A printf/scanf conversion specifiers | hex FP numbers supported in strtod() since 1.5 | |
| compound literals | - | |
| designated initializers | 1.4 | |
| // comments | pre-1.0 | supported as C90 extension |
| extended integer types and library functions in <inttypes.h> and <stdint.h> | 1.3-1.5 | |
| remove implicit function declaration | 1.5, 1.8 | diagnosed via W131 |
| preprocessor arithmetic done in intmax_t/uintmax_t | ? | |
| mixed declarations and code | 1.5 | |
| new block scopes for selection and iteration statements | - | |
| integer constant type rules | ? | |
| integer promotion rules | ? | |
| macros with a variable number of arguments | 1.2 | |
| the vscanf family of functions in <stdio.h> and <wchar.h> | pre-1.0 | |
| additional math library functions in <math.h> | 1.5 | |
| treatment of error conditions by math library functions (math_errhandling) | ? | |
| floating-point environment access in <fenv.h> | 1.3 | |
| IEC 60559 (also known as IEC 559 or IEEE arithmetic) support | ? | |
| trailing comma allowed in enum declaration | pre-1.0 | supported as C90 extension |
| %lf conversion specifier allowed in printf | ? | |
| inline functions | 1.3 | |
| the snprintf family of functions in <stdio.h> | 1.0 | |
| boolean type in <stdbool.h> | 1.3-1.7 | Uses _Bool in -za99 mode, otherwise char |
| idempotent type qualifiers | ? | |
| empty macro arguments | 1.5 | |
| new structure type compatibility rules (tag compatibility) | ? | |
| additional predefined macro names | ? | |
| _Pragma preprocessing operator | ? | |
| standard pragmas | ? | |
| __func__ predefined identifier | 1.2 | |
| va_copy macro | 1.3 | |
| additional strftime conversion specifiers | 1.6 | |
| LIA compatibility annex | ? | |
| deprecate ungetc at the beginning of a binary file | ? | |
| remove deprecation of aliased array parameters | ? | |
| conversion of array to pointer not limited to lvalues | ? | |
| relaxed constraints on aggregate and union initialization | pre-1.0 | -aa only |
| relaxed restrictions on portable header names | pre-1.0 | |
| return without expression not permitted in function that returns a value (and vice versa) | pre-1.0 | diagnosed via W107, E1051, E1096 |



