[Info-vax] Color me confused (VMS C issues, this time with %zu)
Richard Levitte
richard at levitte.org
Wed Oct 26 03:41:11 EDT 2016
I'm a little confused... The VMS C manual [1] states that:
-----8<-----
It also provides complete language support for ISO/IEC 9899:1999, informally called C99, although not all run-time library routines are currently implemented, floating-point environment access controls are not effective, and Annex F (the optional __STDC_IEC_559__ extension) is not supported.
-----8<-----
And sure enough, __STDC_VERSION__ is 199901L.
And yet, this fails to run properly:
-----8<-----
#include <stdio.h>
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define zu "zu"
#else
# define zu "llu"
#endif
int main()
{
size_t foo = 1;
printf("__STDC_VERSION__ is %lu\n", __STDC_VERSION__);
printf("zu is '%s'\n", zu);
printf("foo is %" zu "\n", foo);
}
-----8<-----
See this session:
-----8<-----
$ cc/version
HP C V7.3-018 on OpenVMS IA64 V8.4
$ cc foo.c
printf("foo is %" zu "\n", foo);
...............................^
%CC-W-UNSUPCONVSPEC, In this statement, this argument to printf has a conversion
specification "%zu" that is not supported or not fully supported on this platfo
rm.
at line number 15 in file PROGRAM:[LEVITTE-BUILDS.OPENSSL-EXPERIMENTAL.IA64]FOO.
C;4
$ link foo
%ILINK-W-COMPWARN, compilation warnings
module: FOO
file: PROGRAM:[LEVITTE-BUILDS.OPENSSL-EXPERIMENTAL.IA64]FOO.OBJ;4
$ run foo
__STDC_VERSION__ is 199901
zu is 'zu'
foo is zu
-----8<-----
As far as I know, %zu isa C99 feature and not part of Annex F, so for a compiler that "provides complete language support for ISO/IEC 9899:1999", this leads to fairly ackward preprocessor conditions specially for VMS.
Or really, the the compiler doesn't provide complete language support for C99, should it pretend it does?
Cheers,
Richard
More information about the Info-vax
mailing list