delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/08/06/12:22:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Tue, 06 Aug 2013 19:22:01 +0300
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: _CRT0_FLAG_NULLOK
In-reply-to: <op.w1eankdn0e5s1z@->
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <83txj2vlg6.fsf@gnu.org>
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@->
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

> From: "Rod Pemberton" <dont_use_email AT nohavenotit DOT com>
> Date: Tue, 06 Aug 2013 08:36:46 -0400
> 
> I.e., it wouldn't solve the OP's issue of passing in NULL into a
> string function which doesn't check that the pointer was NULL,
> and error out, safely.

Why are you still arguing?

Let's assume that you and the OP are right and everybody else is wrong
-- where does it leave you two?

It is well known that on every platform that supports C out there a
program will segfault if it tries to dereference a NULL pointer, in
atoi or elsewhere.  Even if HP doesn't, all it means that you can
write C programs which will not crash on that single platform.  Is
that what you want?  Is that what the OP wants?

C programs are extremely portable, or at least they can be written to
be very portable.  Do you want to be able to write C programs that run
as you expect on a single platform, and not the most popular one at
that?

Maybe you think you will be able to talk the Posix and ANSI/ISO
standards committees into changing the language semantics into your
private interpretation?  If so, good luck to you (you will need it!),
but this is not the right forum for such an endeavor.

Until the language standard and its popular implementations change to
support your strange views, all this argument is a futile waste of
breath, and someone who wants to write portable C programs should know
that passing NULL pointers to atoi, strlen, etc. _will_ crash, and
refrain from doing so if they want their program to be reliable,
because there _is_ no "safe erroring out" from that situation, not in C.
Never was, and I dare to predict never will be.

- Raw text -


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