Re: constant references

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Zytan,

Before I wrote this I have looked at the calendar, and it is really 2007.

I thought that I was back in 1967 while I was reading your response.

Although I agree with you in concept is it now much to late start again a
discussion.

As the Arabs had than won the Arab-Isrealy war, than a lot of things would
probably look different now, however you cannot change history (beside in
the schoolbooks of course).

Cor

"Zytan" <zytanlithium@xxxxxxxxx> schreef in bericht
news:1170438311.677183.232900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Stephany,

Yes you're absolutely right - the best of us do make mistakes.

That is why we have robust debugging and testing techniques.

Yes.

Checking that some variable that shouldn't be modified hasn't been is the
most the most basic of those techniques.

No. Leaving such a simple, laborious task to the compiler is one of
the basic of those techniques.

No human can possibly read code like English, and look over a function
in a swift manner, and determine that the constant variables are
unchanging. What happens if one of them is passed to another
function? You have to either look at that function's code, and all
it's inner function calls, all the way down the stack / tree, and
then, if you haven't missed anything (and, since when is any human
perfect), you can determine that the code is correct. If you're
incorrect, hopefully you'll catch the bug during runtime development
and not after deployment, where it's 100 times more costly to fix than
during runtime development.

OR... you could use "const" -- 5 letters -- and let the compiler
notify you during COMPILE time which is 1/10th as costly as catching
it during beta testing. The compiler can go through all your code,
and determine at all levels that the variable is not being changed.
You can create "const" class functions to ensure the class data
members remain unchanged, and these are only allowed to be call other
functions that promise the same thing. All caught at compile time.

This is several ORDERS OF MAGNITUDE more robust than "human checking".

Besides, who has time to check code? Who does this? Even if you
*could* check all that code, and were as perfect as a machine, why
would you want to waste your time doing this? The time would be
better spend writing more robust code, letting the compiler check all
of that for you, removing any worries / intellectual barriers that you
may have about potential broken code.

Zytan



.



Relevant Pages

  • Re: constant references
    ... That is why we have robust debugging and testing techniques. ... The compiler can go through all your code, ... This is several ORDERS OF MAGNITUDE more robust than "human checking". ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Java or C++?
    ... experience that the compiler catches many *more* errors that previously used ... runtime bugs on that account, because the compiler finds them for me. ... > by a more robust language. ... Would you say Java is more robust than C++? ...
    (comp.programming)
  • Re: constant references
    ... If you need the features exposed by the C++ language and the C++ compiler so badly then I don't understand why you are not using that instead of bleating on about something that just "ain't gonna happen". ... That is why we have robust debugging and testing techniques. ... You can create "const" class functions to ensure the class data ... This is several ORDERS OF MAGNITUDE more robust than "human checking". ...
    (microsoft.public.dotnet.languages.vb)
  • Re: What is faster?
    ... > AFA reproducable examples of where the compiler gets it wrong, ... > is inconsistent and I haven't found a particular scenario that is ... I have been hit by this on a few, although rare, ... > I believe that the compiler is robust enough that if you use values besides ...
    (microsoft.public.vb.general.discussion)
  • Compiler positions available for week ending April 8
    ... Compiler Engineer job at Coherent Logix ... implementing advanced optimizations for our multi-core DSP ... Development of advanced compiler optimization techniques for our multi-core ...
    (comp.compilers)