delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/09/05/05:45:17

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <413adfc9$0$173$cc7c7865@news.luth.se>
From: Martin Str|mberg <ams AT speedy DOT ludd DOT ltu DOT se>
Subject: Re: scanf: strange behavior?
Newsgroups: comp.os.msdos.djgpp
References: <20040902144152 DOT GH6858 AT webhome DOT cz> <41373f54$0$175$cc7c7865 AT news DOT luth DOT se>
User-Agent: tin/1.4.6-20020816 ("Aerials") (UNIX) (NetBSD/1.6Q (alpha))
Date: 05 Sep 2004 09:43:37 GMT
Lines: 32
NNTP-Posting-Host: speedy.ludd.ltu.se
X-Trace: 1094377417 news.luth.se 173 130.240.16.13
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Martin Str|mberg <ams AT speedy DOT ludd DOT ltu DOT se> wrote:
> Egon Eckert <egon AT heaven DOT industries DOT cz> wrote:
>> compiling and running this code:

>> #include <stdio.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 a standard(1) violation in GNU libc and Borland C++ 3.1 (if your
> report is accurate).

> 1. C99 (at least).

I have to retract my words. I was thinking of another case (see
another follow-up in this thread). So right now I think 1 is the right
return value.


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019