Re: fclose(0)



Richard Heathfield wrote:
lawrence.jones@xxxxxxxxxxx said:

Bartc <bc@xxxxxxxxxx> wrote:
If this was the case then it would be better to admit it rather than
suggest, as a few people have, that crashing on passing a null pointer
is actually a good idea.
It *is* a good idea:

No, it's merely a useful consequence.

it forces programmers to fix their defective code.

If that were true, it would be a pity that it isn't guaranteed by the
Standard. But it isn't true, of course. Some programmers never even see
the crashes, let alone fix their causes. For example, I have a web browser
written by someone else, which crashes whenever I accidentally click on a
PDF link and then click "cancel" on the subsequent dialog asking if I want
to hand over my firstborn to Adobe. Clearly the programmer never bothered
to test this execution path, so he has /not/ been forced to fix his
defective code.

But he or she would if a paying customer filed a bug report. That is,
unless he or she works for a well known supplier of non-compliant browsers.

--
Ian Collins.
.



Relevant Pages

  • Re: fclose(0)
    ... suggest, as a few people have, that crashing on passing a null pointer ... Some programmers never even see ... the crashes, let alone fix their causes. ...
    (comp.lang.c)
  • Re: Troolean operators
    ... Yes, but it crashes all the time, because the programmers, never said, ... true false or something else, they always say, true false or error out, ... bad memory assignment or whatever. ...
    (sci.physics)
  • Re: why the usage of gets() is dangerous.
    ... Without fat pointer and checking you get memory corruption, ... Those who bother to attach a debugger and see where it crashes will immediately know where it crashes and why. ... Most programmers also find tools that pinpoint the bugs more accurately by causing the failure to happen earlier to to be useful. ... By your argument we should not do any testing of any libraries or any SW because then it will be VALIDATED and the programmer will assume something else must be wrong when it crashes. ...
    (comp.lang.c)
  • Re: security issues with forth
    ... Crashes are instructive. ... but these were students writing student exercises. ... a difference between that and professionals writing code that will be ... I see experienced application programmers do this all the time! ...
    (comp.lang.forth)
  • Re: [opensuse] frustration and suggestions
    ... It is directed at the "features galore, never mind the crashes" attitude of ... more and more "programmers". ... that is just as bad as firefox catching ... itself crashing, imo they should concentrate on eliminating the crashes, ...
    (SuSE)