🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1469

Re: Explain this sscanf behavior.

#1469
From: Bradford R. Daniels
Date: Fri, 06 Jul 1990 22:17
32 lines
1511 bytes
> 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...

> compiler C:
> 	x=1  a=123  b=3
> 	x=1  a=123  b= -99

This is also wrong, since %n does not consume any input, and so the
lack of input should not cause it to fail.

> I'm confused????!!!!! Compiler C is "100% ANSI compatible".????

ANSI compatible does not mean bug free.  This behavior is a bug, and
I think I see how it's happening...  In fact, I think I'll go make sure
my RTL doesn't have the same problem...

- 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: <13168@shlump.nac.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!decatl!shlump.nac.dec.com!tle.enet.dec.com!daniels
References: <1990Jul6.181830.2549@tc.fluke.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!decatl!shlump.nac.dec.com!tle.enet.dec.com!daniels
From: daniels@tle.enet.dec.com (Bradford R. Daniels)
Newsgroups: comp.std.c,comp.lang.c
Subject: Re: Explain this sscanf behavior.
Keywords: sscanf ANSI
Message-ID: <13168@shlump.nac.dec.com>
Date: 6 Jul 90 22:17:06 GMT
References: <1990Jul6.181830.2549@tc.fluke.COM>
Sender: newsdaemon@shlump.nac.dec.com
Reply-To: daniels@tle.enet.dec.com (Bradford R. Daniels)
Followup-To: comp.std.c
Organization: Digital Equipment Corporation
Lines: 32