I have a problem about checksum and I am in a hurry to understand. The same source code is compiled by different version of KeilC compiler. Are their checksum same? If they are different, how to prove they are same source code? Please give me a answer. Thank you very much.
"The same source code is compiled by different version of KeilC compiler. Are their checksum same?" The quick answer is: NO! "how to prove they are same source code?" You can't.
The point is that no compiler gives you any guarantee whatsoever that any particular source construct will generate any specific sequence of machine instructions. Even rebuilding the same source with the same compiler is not guaranteed to give the same object - you might have changed some options like optimisation... This is the reason why changing compiler version during a product's lifetime is a very significant issue! This is the principal reason, eg, why it's fruitless to try to write predictable software delay routines in high-level languages!
Thanl you very much. But I have a question. In the same harware, the same source code is compiled by different KeilC compiler version. Are their results same, eg, Action?
"In the same harware, the same source code is compiled" What do you mean by "the same hardware" here? The source code is compiled on your PC - that's the Host hardware; The resulting binary image is run on your 8051 - that's the Target hardware. "compiled by different KeilC compiler version. Are their results same, eg, Action?" That is the idea. You should think of High-Level Language (HLL) source code as a specification for what the code must do - without any detail of how that will actually be implemented on the target hardware. So, compiling the same source with different version compilers will give the same action provided that your code does not rely upon any specific details of the particular compiler version - whether intentionally or otherwise. eg, a different compiler version might locate the code and/or data differently in memory; your source code should not depend on this but, if it does, you are likely to get problems. Similarly, a different compiler version might generate code with slightly different timings (faster or slower); again, your source code should not depend on this but, if it does, you are likely to get problems. There is a lot more to making source code "Portable" than just writing it in 'C'...!
In the same harware, the same source code is compiled by different KeilC compiler version. Are their results same, eg, Action? yes, they should work the same and they will if you have coded correctly. now what can go wrong? I just had an example here. I modified a non-communication routine in some inhereited code and the communication section (which I did not touch) started having intermittent problems. When I finally found the cause it was that in a 5 year old product, sold in the thousands, an interrupt handler was incorrectly coded. This problem never showed up till the main loop run time changed. Should this keep you from upgradeing? by no means, it should tell yoy that "testing" does not "prove" diddlysquat. Based on this I have added to the test suite that all code is tested compiled by two different versions, not that that "proves" anything, but the likelyhood of finding dormant errors is increased. Erik
"'testing' does not 'prove' diddlysquat." That's not quite true. Testing does show that your system behaves as you expected under the conditions of the test. Of course, that is no proof that your system is entirely correct - as Erik's example shows!
Andy, I agree ( see highlights "'testing' does not 'prove' diddlysquat." That's not quite true. Testing does show that your system behaves as you expected under the conditions of the test. Erik
Tests can prove the presence of errors, but not the absence thereof.
the classic quote "succesful testing does not prove the abscence of errors, it proves the abscence of known errors" Erik