Re: Increasing efficiency in C

From: Nick Landsberg (hukolau_at_NOSPAM.att.net)
Date: 03/05/04


Date: Fri, 05 Mar 2004 20:50:20 GMT


Mike Wahler wrote:

> "jacob navia" <jacob@jacob.remcomp.fr> wrote in message
> news:c2ajah$t8a$1@news-reader3.wanadoo.fr...
>
>>"Mike Wahler" <mkwahler@mkwahler.net> a écrit dans le message de
>>news:9G32c.22867$aT1.20587@newsread1.news.pas.earthlink.net...
>>
>>>Back [almost?] to topic: If I couldn't control my memory handling
>>>and pointers, I wouldn't use C.
>>
>>You keep control of everything.
>
>
> That's right. That's why I like C. But with such
> control comes responsibility. I if lose control,
> it's my own fault.
>
>
>>But the system should
>>have an automatic.
>
>

[ Much Snipped ]

Another 2 cents US into the discussion.

The "C" language is used for a multitued of
applications. For some of these applications,
failure is benign, for some not.

Jacob, in your proposal what should be the
default behavior if an array bounds is
exceeded? Abort the program?

If it is on a PC web browser, that is perfectly
acceptable behaviour. (I think).

If it is in a program running a heart-lung machine,
I doubt that it is.

If a programmer were to use current C and his/her
program caused the heart-lung machine to go haywire,
that programmer ought to be shot (overstatement).
If, using your proposal, and the default was to abort
the program, that programmer should still be shot!

If the default is not to abort the program, what then?
Continue as we do today? That's a no-op.

If the proposal is to override the behaviour and take
intelligent action when that happens, then the
selfsame competent programmers who today take pains
to make sure they do not exceed array bounds would
be the ONLY ones who took the same pains to override
default behaviour. For the incompetent ones, the program
would abort. (Possibly a little sooner than it does now,
I'll grant that. Maybe training them to be more
competent would be a better answer?) As Dan Pop, I believe,
said, "C is structured assembler." To use it properly
you have to develop a certain expertise. This expertise
involves checking all possible error conditions. If you
don't do that, you should not be programming in C.

See .sig line.

You are trying to make it foolproof. :)

-- 
Ñ
"It is impossible to make anything foolproof because fools are so 
ingenious" - A. Bloch


Relevant Pages

  • Re: Thread lock on HtmlDocument.InvokeScript
    ... entire behavior of the control is not supported. ... the WebBrowser control is really a wrapper around unmanaged ... you aren't going to be able to abort a call to most ... I am using the WebBrowser control in a secondary thread ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ASSERT I dont understand (modeless dialog and posting messages)
    ... Get rid of the GetDlgItem and use a control variable. ... >modeless dialog to it's main window that I don't understand. ... >a progress ctrl and an abort button on this dialog. ... it posts a final UWM message back to the main window that it ...
    (microsoft.public.vc.mfc)
  • Re: Datagrid - end edit?
    ... > have a suggestion I would appreciate it. ... > when the abort is call. ... PMI is the edit control to edit the data but ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Apollo 11: A Night to remember
    ... The abort system was fine and would have been selected for an abort. ... The program alarms didn't have anything to do with manual control being used either; the computers were still in control until Armstrong decided that the original landing site was unusable and took control. ...
    (uk.tech.broadcast)
  • Re: Detect a Laptops On Battery
    ... My "expertise" is ... subclassing route (but at the expense of some small amount of system ... The control, once added to the project, might provide some additional ...
    (microsoft.public.vb.general.discussion)