Topic: What a good compiler can check?


Author: jkauer@opal.tufts.edu (Jonathan Borden)
Date: 1995/05/02
Raw View
In article <3nmnsd$6l6@peippo.cs.tut.fi>, p150650@sinisorsa.cs.tut.fi (Pulkkinen Tero) writes:
> Today compilers can check many errors from the code. C++ programmers
> can give the compiler more information about the "real" meaning, purpose of
> our code than it was possible before. Compilers can, with that extra
> information, make many more checks of our code than without the information.
>
> Now the question is, how much can a compiler check our code? How much extra
> information we need to give to compiler, so that it could make the checks?
> Does C++ program offer now enough information to the compiler?
>
> What could be checked by a compiler (compile time)?
> - Restricting access of information and checking violations of that
>   restriction (already in the C++ language)
> - Restricting changes of information (partly in C++ language)
> - Maybe compiler could check if class's state is always "valid"
>   after a member function has been executed?
> - If some invariant appiles at start of a block/function/member function/
>   class, maybe a compiler can check that it applies at the end of use of it?
> - Could a compiler prove that our design/code has no bugs?
 How do you specify design? How do you specify code. All programs which
compile should operate as specified by the code. Ah, so a bug is an error in
specification ... an error in translating the design into code ... in what
language do you specify design?
>
> What information is needed to provide such checks?
>
> Of course it shouldn't be so that you absolutely have to give the compiler
> that extra information. If you *have* to give too much information, it might
> be annoyance to the programmer who doesnt need to make secure, bugfree,
> perfect code, but to us others, being able to use extra checks might save
> us years of time spend to testing, fixing the code.
>
 NEVER can be done ... one person's 'bug' is another's 'feature'.

jon borden
jabr technology corporation
medical image objects






Author: p150650@sinisorsa.cs.tut.fi (Pulkkinen Tero)
Date: 1995/04/27
Raw View
Today compilers can check many errors from the code. C++ programmers
can give the compiler more information about the "real" meaning, purpose of
our code than it was possible before. Compilers can, with that extra
information, make many more checks of our code than without the information.

Now the question is, how much can a compiler check our code? How much extra
information we need to give to compiler, so that it could make the checks?
Does C++ program offer now enough information to the compiler?

What could be checked by a compiler (compile time)?
- Restricting access of information and checking violations of that
  restriction (already in the C++ language)
- Restricting changes of information (partly in C++ language)
- Maybe compiler could check if class's state is always "valid"
  after a member function has been executed?
- If some invariant appiles at start of a block/function/member function/
  class, maybe a compiler can check that it applies at the end of use of it?
- Could a compiler prove that our design/code has no bugs?

What information is needed to provide such checks?

Of course it shouldn't be so that you absolutely have to give the compiler
that extra information. If you *have* to give too much information, it might
be annoyance to the programmer who doesnt need to make secure, bugfree,
perfect code, but to us others, being able to use extra checks might save
us years of time spend to testing, fixing the code.


Yours,

-- Tero Pulkkinen -- p150650@cs.tut.fi --

ps. sorry about syntax errors in the article, but my compiler didn't check
    them properly... :-)