Now that I know that this feature is not standard C, I'm sort of
relieved that I didn't know about it
and "fixed" the problem in my recent answer by simply removing the 1$
etc. flags, which didn't tell me anything :-)
Another remark from the view point of a compiler builder: these nn$
flags, which allow the addressing of the
subsequent parameters of printf etc. out of sequence (say, by index),
require that all the parameters or addresses
of printf are placed in a vector of appropriate size, so that they can
be referenced later. The size of this vector
is the NL_ARGMAX constant mentioned earlier. This vector etc. is not
necessary, if the parameters are processed
in the same sequence as the % tags appear in the printf pattern, which
is also faster IMO.
So I'm not surprised that this feature is not part of the C (library)
standard.
BTW: I really hope that clever C compilers do some optimization on
printf and similar function calls,
given constant patterns - and maybe extended diagnostics, such as: do
the parameters agree with the tags in
the pattern? Does the count of parameters match the number of tags in
the pattern?
If the patterns are variables, then, of course, there is no chance ...
Kind regards
Bernd
Am 03.10.2025 um 16:29 schrieb Phil Smith III:
My final (hah!) word on the topic: while looking at this more, I googled "nl_argmax
printf" (without the quotes) and the AI summary is pretty coherent,
noting that the limit varies, that the feature isn't standard C but is a POSIX
thing, etc. It even points to limits.h.
As usual, once I knew the answer, the right question was easy!
Thanks again.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN