Mail Archives: djgpp/2013/07/31/06:45:12
On Wed, 31 Jul 2013 00:38:16 -0400, Stephen J. Turnbull
<turnbull AT sk DOT tsukuba DOT ac DOT jp> wrote:
> Georg Potthast writes:
>
> > I still feel it would be a better "user experience" if atoi() would
> > not crash. As far as I understand the specification does not
> > require atoi() to crash if a NULL pointer is passed.
>
> No, it doesn't. But "not crashing" is not necessarily a better end
> user experience, although it may allow a programmer to save a few
> lines.
...
> It is not possible to give a consistent specification of what
> happens when NULL is passed to a function,
It sure is _possible_. It just wasn't done. That's entirely different
than actually *not* being able to specify something.
> [...] because by definition (C standard) there can be no
> valid data pointed to by that pointer.
Non-sequitur. This does not follow, at all...
Providing a consistent specification for passing a NULL pointer and the
presence or lack thereof of valid data pointed to by a pointer have
*NOTHING WHATSOEVER* to do with each other. They're 100% independent.
> Therefore any behavior is necessarily arbitrary.
This conclusion is non-sense.
> [...] in accordance with the
> general philosophy of C that it's the programmer's responsibility to
> assure correctness at any level above machine language, [...]
It's the C programmers responsibility to ensure the assembly and machine
language are correct too. Are you saying an employer is going to hire
someone else to do that? Non-sense. You coded it. You're responsible
for it. If there is a major bug in the assembly or machine code, it's
definately you who'll get blamed for the error. So, that's a part of
your job too, whether you like it or not. Well, the exception is if
you're stupid. Stupid people ignore doing their job because they can
get away with it for a time, or because they're underpaid, or because
they don't have enough time, or because work is cutting into their
personal life, or because of some other excuse.
Rod Pemberton
- Raw text -