[Cfp-interest] printf flag character for NaNs
David Hough CFP
pcfp at oakapple.net
Wed Apr 13 16:46:15 PDT 2011
Last time we wondered about using a flag character to modify the output
treatment of NaNs (we could also use it to modify scanf input treatment
if needed).
The standard flag characters -+#0 and space already have semantics for
floating-point output that we don't want to overlay with NaN semantics.
So we need a new one... looking at the top of my keyboard I see
!@$^&~?
which aren't overloaded in this context as far as I know and aren't part of
pairs like () {}.
Of these, ~ or "not" is vaguely reminiscent of "not a number".
The letter n is in use for indicating a pointer to a signed integer which
gets the number of characters read so far by printf.
The letter N might be available, but it sounds like a poor plan to me to
have such a major case distinction.
So at this point, I suggest ~ but not with a lot of enthusiasm, and knowing
that I may have overlooked something. Anybody use %~ to mean something
implementation-specific for printf or scanf?
More information about the Cfp-interest
mailing list