delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/08/06/23:15:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
NNTP-Posting-Date: Tue, 06 Aug 2013 21:58:53 -0500
From: "Charles Sandmann" <cwsdpmi AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
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> <3df2f50f-9543-47a7-8e40-a9be82ce5018 AT googlegroups DOT com> <87fvuvny2v DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <op.w020sren0e5s1z@-> <87ehaeonbp DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <op.w04oetou0e5s1z@-> <87zjt1n2v6 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <op.w08sjo1c0e5s1z@-> <8761vmn519 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <op.w1eankdn0e5s1z@-> <83txj2vlg6 DOT fsf AT gnu DOT org> <1d5d0ab5-8e24-4149-891e-62108504529b AT googlegroups DOT com>
Subject: Re: _CRT0_FLAG_NULLOK
Date: Tue, 6 Aug 2013 21:58:51 -0500
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-RFC2646: Format=Flowed; Original
Message-ID: <GbOdnSjbstRwKpzPnZ2dnUVZ_sydnZ2d@earthlink.com>
Lines: 27
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 64.91.136.221
X-Trace: sv3-QOeG/SO1ZiOnofvsa8KQuv3TlYbkGDV8l0lTlQt9pyTWymek75NraTcvqAVl3SFEXdHqBvGwwaQiFCM!77QspI/8iJ0PxNN6ypppYJBX31c7c739ao620VI+3s1k33Wg/ZSQUtynXvMRvNHvTZNc/Zv0q6WV!LNsmeYM3IDYIIATFANeqE/NwihZyYVT3
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 3055
X-Original-Bytes: 2994
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Georg Potthast" <dosusb AT googlemail DOT com> wrote in message 
news:1d5d0ab5-8e24-4149-891e-62108504529b AT googlegroups DOT com...
>I did not post further messages because I understand that the djgpp 
>developers could not be convinced to make a change here.
>As Rod pointed out with the links he provided this topic has been discussed 
>already 25 years ago and no change was made yet.

Note that I wanted NULL pointer protection so badly (for portability and 
error checking) that I added it to CWSDPMI and to the DJGPP runtime.  We all 
agreed this was the correct default behavior, but if you need to allow 
referencing NULL pointers you can use the _CRT0_FLAG_NULLOK, or launch 
cwsdpmi with the -x qualifier before your program to disable the DPMI 1.0 
extension that supports the NULL pointer detection.  It is your choice.

However, when it comes to adding code to the runtime library to encourage 
bad coding practices, every program written should not need to carry the 
extra bloat to support this, which is why it's not in the library.

>The library I am using returns NULL instead of an empty string. So I will 
>have to trap
>NULL before calling atoi() and fill the integer variable with zero then.

Good portable choice.  You could also put a #define in your code to make 
atoi() be null_ok_atoi() as a wrapper, write this function yourself to do 
the check before calling atoi().


- Raw text -


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