Explain this sscanf behavior.

Kim Shearer kim at wacsvax.cs.uwa.OZ.AU
Fri Jul 13 20:01:11 AEST 1990


In <13168 at shlump.nac.dec.com> daniels at tle.enet.dec.com (Bradford R. Daniels) writes:

>> compiler A:

>> 	x=1   a=123  b=3
>> 	x=1   a=123  b=3

>This is the correct result.

>> compiler B:
>> 	x=1   a=123  b=3
>> 	x=1   a=123  b=4  <-- yes 4.

>This is clearly wrong, since there aren't even 4 characters in the string...

 Why, the value of b is clearly invalid as only one
 argument was comsumed. Nothing was read into b so
 how can you say it was incorrectly assigned.

+--------------------------------+--------------------------------------------+
Kim Shearer                      |     ARPA: kim%wacsvax.uwa.oz at uunet.uu.net
Dept. of Computer Science        |     UUCP: ..!uunet!munnari!wacsvax!kim
University of Western Australia  |     ACSnet: kim at wacsvax.uwa.oz       
CRAWLEY, Australia 6009          |     PHONE:  +61 9 380 3452 
+--------------------------------+--------------------------------------------+



More information about the Comp.std.c mailing list