🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1504

Re: Explain this sscanf behavior.

#1504
From: Bradford R. Daniels
Date: Fri, 13 Jul 1990 15:45
22 lines
1405 bytes
> >> 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.

Pardon?  I have to disagree with you here.  Clearly, an assignment was made,
otherwise the value of b would be -99.  The return value of 1 tells us nothing,
since the standard explicitly states that the count of converted arguments
does not get incremented by %n.

- Brad

-----------------------------------------------------------------
Brad Daniels			|  Digital Equipment Corp. almost
DEC Software Devo		|  definitely wouldn't approve of
"VAX C RTL Whipping Boy"	|  anything I say here...
Technical Details
Message-ID: <13414@shlump.nac.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!decuac!shlump.nac.dec.com!tle.enet.dec.com!daniels
References: <kim.647863271@wacsvax.cs.uwa.oz.au> <1990Jul6.181830.2549@tc.fluke.COM> <13168@shlump.nac.dec.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aplcen!haven!decuac!shlump.nac.dec.com!tle.enet.dec.com!daniels
From: daniels@tle.enet.dec.com (Bradford R. Daniels)
Newsgroups: comp.std.c
Subject: Re: Explain this sscanf behavior.
Keywords: sscanf ANSI
Message-ID: <13414@shlump.nac.dec.com>
Date: 13 Jul 90 15:45:07 GMT
References: <kim.647863271@wacsvax.cs.uwa.oz.au> <1990Jul6.181830.2549@tc.fluke.COM> <13168@shlump.nac.dec.com>
Sender: newsdaemon@shlump.nac.dec.com
Reply-To: daniels@tle.enet.dec.com (Bradford R. Daniels)
Organization: Digital Equipment Corporation
Lines: 22