www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/07/30/16:30:12

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.224.171.72 with SMTP id g8mr68803842qaz.7.1375215337741;
Tue, 30 Jul 2013 13:15:37 -0700 (PDT)
X-Received: by 10.49.81.208 with SMTP id c16mr972860qey.34.1375215337722; Tue,
30 Jul 2013 13:15:37 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Tue, 30 Jul 2013 13:15:37 -0700 (PDT)
In-Reply-To: <f24e8cd3-83ca-4386-a319-a9adb4d74c68@googlegroups.com>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.174.141.199;
posting-account=v5xbdQoAAAAOGc9Ccc-kLZyobvPlN3Qr
NNTP-Posting-Host: 2.174.141.199
References: <21e77579-1a40-4442-8111-fc976fba78fc AT googlegroups DOT com>
<b5o37qFldl9U1 AT mid DOT dfncis DOT de> <f24e8cd3-83ca-4386-a319-a9adb4d74c68 AT googlegroups DOT com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3df2f50f-9543-47a7-8e40-a9be82ce5018@googlegroups.com>
Subject: Re: _CRT0_FLAG_NULLOK
From: Georg Potthast <dosusb AT googlemail DOT com>
Injection-Date: Tue, 30 Jul 2013 20:15:37 +0000
Bytes: 2114
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Yes, the code works fine in a Windows XP DOS box and crashes in real mode DOS. That is the reason I posted this. Anyhow, I now changed my code and test if the variable is not NULL.

I still feel it would be a better "user experience" if atoi() would not crash. As far as I understand the specification does not require atoi() to crash if a NULL pointer is passed.

In one of your links it says:
>In AIX when passed a NULL to strchr(), it returns a NULL and the program runs >without aborting

I also found this with HP Tru64 UNIX:

int atoi(const char *nptr );

ERRORS
If nptr is NULL, the functions return 0 and do not set errno.

So some system do avoid a crash with atoi().

Georg

http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V51B_HTML/MAN/MAN3/1938____.HTM


P.S. I tried to post a similar message before which seems to have vanished.



- Raw text -


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