cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/2013/07/29/21:00:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Received: by 10.224.169.1 with SMTP id w1mr39104578qay.4.1375145388697;
Mon, 29 Jul 2013 17:49:48 -0700 (PDT)
X-Received: by 10.49.94.203 with SMTP id de11mr1273983qeb.37.1375145388672;
Mon, 29 Jul 2013 17:49:48 -0700 (PDT)
Newsgroups: comp.os.msdos.djgpp
Date: Mon, 29 Jul 2013 17:49:48 -0700 (PDT)
In-Reply-To: <b5o37qFldl9U1@mid.dfncis.de>
Complaints-To: groups-abuse AT google DOT com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=78.45.215.137;
posting-account=Q0wMHAoAAADjYrghh94FTf6YnbpTqZgp
NNTP-Posting-Host: 78.45.215.137
References: <21e77579-1a40-4442-8111-fc976fba78fc AT googlegroups DOT com> <b5o37qFldl9U1 AT mid DOT dfncis DOT de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f24e8cd3-83ca-4386-a319-a9adb4d74c68@googlegroups.com>
Subject: Re: _CRT0_FLAG_NULLOK
From: RayeR <glaux AT centrum DOT cz>
Injection-Date: Tue, 30 Jul 2013 00:49:48 +0000
Bytes: 1793
Lines: 8
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

> Where did you gather the impression that NULL was a valid input for atoi()?

Yes, probably because of speed and simplicity C string functions doesn't check NULL pointers. When I program some higher-level function operating with pointers I usualy check for NULL at the beginning and return with error code.

This topic was many discused, e.g. here:
http://bytes.com/topic/c/answers/946249-passing-null-atoi-function-results-segmentation-fault
and here
http://stackoverflow.com/questions/8972247/what-if-null-is-passed-in-strchr
I compiled and run test program and it didn't crashed under WXP (DJGPP and MINGW binary) but it doesn't proof it's OK.

- Raw text -


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