Changes

Jump to navigation Jump to search
903 bytes added ,  19:21, April 2, 2012
add section: 'Dealing with errors'
Line 2: Line 2:     
There are compilers for the more common programming languages available on a wide variety of different computer architectures.  This means that a program written in one of these languages may be ''portable'' and can often be used on any of the different machines just by using the appropriate compiler; note that there may be occasional problems with machine-dependencies, especially if there are substantial differences in the accuracy and size of numbers on the different machines.
 
There are compilers for the more common programming languages available on a wide variety of different computer architectures.  This means that a program written in one of these languages may be ''portable'' and can often be used on any of the different machines just by using the appropriate compiler; note that there may be occasional problems with machine-dependencies, especially if there are substantial differences in the accuracy and size of numbers on the different machines.
 +
 +
When first written many programs contain errors. Some errors can be detected by the compiler while other errors might only be detected when a program is running. Some errors only occur under very specific circumstances and may never be detected.
    
Some compilers just perform a fast simple-minded translation from high-level source code to low-level machine language, while other compilers may optionally take (much) longer to perform the compilation by trying to improve or optimise the resulting machine code.   
 
Some compilers just perform a fast simple-minded translation from high-level source code to low-level machine language, while other compilers may optionally take (much) longer to perform the compilation by trying to improve or optimise the resulting machine code.   
−
  −
Many programs, when first written, contain errors, so it is important that compilers detect these errors and provide a clear report as to what the error is and where it was detected (unfortunately the point of detection can be in some cases be many lines away from the actual source of the error).
      
==History==
 
==History==
Line 63: Line 63:     
:'''Assembly and linking''': translate the assembly language into executable machine code.
 
:'''Assembly and linking''': translate the assembly language into executable machine code.
 +
 +
==Dealing with errors==
 +
Almost all non-trivial programs contain errors. Detecting and fixing all errors is very expensive and time-consuming, so a balance has to be struck between the potential effect of certain errors (e.g. could they be life-threatening?) and the cost of fixing them.  The design of a programming language may also affect the likelihood of certain types of errors and the difficulty or otherwise of fixing them.
 +
 +
During translation compilers can usually detect all errors due to lexical or syntactical mistakes (spelling and grammar); they may also be able to detect a few simple semantic errors (meaning). Even when a compiler does detect and report an error, all it can do is report what the error is and where it was detected; unfortunately the point of detection can be in some cases be many lines away from the actual source of the error; also it may be difficult to explain the error in terms that the programmer can understand.
    
==Optimisation==
 
==Optimisation==
SkipCaptcha
265

edits

Navigation menu