Mail Archives: djgpp/2004/09/02/11:00:05
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | "Tornado" <12 AT 3 DOT 4>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <20040902144152 DOT GH6858 AT webhome DOT cz>
|
Subject: | Re: scanf: strange behavior?
|
Lines: | 32
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1106
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1106
|
Message-ID: | <cpGZc.188151$OR2.8757434@news3.tin.it>
|
Date: | Thu, 02 Sep 2004 14:48:40 GMT
|
NNTP-Posting-Host: | 82.52.73.4
|
X-Complaints-To: | "Please send abuse reports to abuse AT tin DOT it and technical notifications to newsmaster AT tin DOT it"
|
X-Trace: | news3.tin.it 1094136520 82.52.73.4 (Thu, 02 Sep 2004 16:48:40 MET DST)
|
NNTP-Posting-Date: | Thu, 02 Sep 2004 16:48:40 MET DST
|
Organization: | TIN
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
>
> #include <stdio.h> ... #include <stdarg.h> ? ..??
>
> int main(int, const char**)
> {
> char c[2];
> printf("%d\n", sscanf("A", "%c%c", c, c + 1));
> return 0;
> }
>
> gives:
>
> 1 in GNU libc (on Linux)
> 1 in Borland C++ 3.1 (on DOS)
> -1 in djgpp
>
> It's conformant with the docs: "If input ends, or if there is any
> input failure before the first item is converted and assigned, `EOF'
> is returned.", so it's not to be called a 'bug', but...
>
> Do you think it's a standard violation, or just a "difference",
> ie. behavior not specified by POSIX, ANSI or other (involved)
> authority?
>
> Thanks,
>
> --
> Egon Eckert, Heaven Industries, s.r.o.
> E-mail: egon AT heaven DOT industries DOT cz
- Raw text -