ANSI draft interpretation questions

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Jan 7 15:22:56 AEST 1990


In article <21675 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
-%*n	suppresses assignment; no action occurs: it is a no-op.

Right.

-	(%n is a conversion, but is not an assignment; ...

No, %n involves both a conversion and an assignment, but no input action.
The assignment is suppressed by *, in which case there is really no need
for the implementation to perform the conversion since it merely wastes
CPU cycles.  (The same applies to other conversion when the assignment is
suppressed, although most implementations will probably combine lexing
with conversion and thus not be conviently able to skip the conversion.)

-%[efg]	reads a floating point number.  If the input has one of the forms
-		<opt-sign><nondigit>
-		<opt-sign>.<nondigit>
-	no input is consumed.

Right.  Similarly for any other ill-formed string.

-			       If the input has one of the forms
-		<opt-sign><digit-seq><exp><opt-sign><nondigit>
-		<opt-sign><digit-seq>.<exp><opt-sign><nondigit>
-		<opt-sign><digit-seq>.<digit-seq><exp><opt-sign><nondigit>
-		<opt-sign>.<digit-seq><exp><opt-sign><nondigit>
-	the <exp>, the second <opt-sign>, and the <nondigit> remain
-	unconsumed.

Right.

-%[dioux] reads an integer.  If the input has one of the forms
-		<sign><nondigit>
-	no input is consumed.

Right.

-			       If the input has the form
-		<opt-sign>0x
-		<opt-sign>0X
-	and the conversion is either `i' or `x', the sign (if any) and
-	the zero are consumed; the `x' or `X' remains unconsumed.

Right (assuming that there is no hex digit immediately following the x).

DISCLAIMER:  This is my personal interpretation of the Standard;
for an official interpretation you must send a request to X3J11 via X3.



More information about the Comp.std.c mailing list