Mail Archives: djgpp/2013/08/06/12:22:49
> 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 -