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" Newsgroups: comp.os.msdos.djgpp References: <21e77579-1a40-4442-8111-fc976fba78fc 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> <87ehaeonbp DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <87zjt1n2v6 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <8761vmn519 DOT fsf AT uwakimon DOT sk DOT tsukuba DOT ac DOT jp> <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: 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" 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().