🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1485

Re: Explain this sscanf behavior.

#1485
From: Arne Henrik Juul
Date: Sun, 08 Jul 1990 23:15
15 lines
1223 bytes
In article <376@demott.COM>, kdq@demott.COM (Kevin D. Quitt) writes:
|>..., and gnu's gcc
|>coredumps. 

That is, you get a coredump on sscanf(str,"%d%n",&a,&b).
This is indeed correct, since your sscanf() (like mine) probably writes
to the format string or the argument str, and it isn't allowed to do that.

Try compiling with -fwritable-strings.
GCC puts string constants in the non-writable text segment by default.

Of course sscanf is broken, but that's our tough luck...

-- arnej@solan.unit.no -- juul@norunit.bitnet -- arnej@olga1.olga.unit.no --  
--                This disclaimer intentionally left blank                --
Technical Details
Message-ID: <1990Jul8.231520.27479@idt.unit.no>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!njin!uupsi!sunic!nuug!sigyn.idt.unit.no!solan11.solan.unit.no!arnej
References: <1990Jul6.181830.2549@tc.fluke.COM> <376@demott.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!njin!uupsi!sunic!nuug!sigyn.idt.unit.no!solan11.solan.unit.no!arnej
From: arnej@solan11.solan.unit.no (Arne Henrik Juul)
Newsgroups: comp.std.c
Subject: Re: Explain this sscanf behavior.
Keywords: sscanf ANSI
Message-ID: <1990Jul8.231520.27479@idt.unit.no>
Date: 8 Jul 90 23:15:20 GMT
References: <1990Jul6.181830.2549@tc.fluke.COM> <376@demott.COM>
Sender: news@idt.unit.no (Usenet news admin)
Reply-To: arnej@solan1.solan.unit.no
Organization: Norwegian Institue of Technology
Lines: 15