Page 316 - DCAP404 _Object Oriented Programming
P. 316

Unit 14: Advanced Concept in C++




                 Strcpy  (  Ihs  ,  rhs)  ;                                                     Notes
                 Strcpy  (  rhs  ,  tmp  )  ;
                 }

          14.5 Point of Instantiation

          A template function gets instantiated under the following circumstances:
          1.   Implicitly instantiated because it is referenced from a function call that  depends on  a
               template argument.
          2.   Implicitly instantiated because it is referenced within a default argument in a declaration.
          3.   The point of instantiation of a function template specialization immediately follows the
               declaration or definition that refers to the specialization.

          Self Assessment

          Fill in the blanks:
          6.   Error isolation is useful for locating an error resulting in a ....................... message.
          7.   The goal of object-oriented software development is to construct a model of ..................... .

          8.   ....................... activities are those activities that take place simultaneously.

          14.6 Error Handling

          We now know the syntactic errors and execution errors usually produce error messages when
          compiling or executing a program. Syntactic errors are relatively easy to find and correct, even
          if the resulting error messages are unclear. Execution errors, on the other hand, can  be much
          more troublesome. When an execution error occurs, we must first determine its location (where
          it occurs) within the program. Once the location of the execution error has been identified, the
          source of the error (why it occurs) must be determined. Location of the execution  error  occurred
          often assists, however, in recognizing and correcting the error.
          Closely related to execution errors are  logical errors.  Here the program executes  correctly,
          carrying out  the programmer’s wishes, but the programmer has supplied the computer with
          instructions that  are logically incorrect. Logical  errors can be very difficult to detect, since the
          output  resulting from a logically incorrect program may appear to be error-free.  Moreover,
          logical errors are often hard to locate even when they are known to exist (as, for example).
          Methods are available for finding the location of execution errors and logical  errors within a
          program. Such methods are generally referred to as debugging techniques. Some of the more
          commonly used debugging techniques are described below.
          14.7 Error Isolation


          Error isolation is useful for locating an error resulting in a diagnostic message. If the general
          location of the error is not known, it can frequently be found by temporarily deleting a portion
          of the program and then rerunning the program to see if the error disappears. The temporary
          deletion is accomplished by surrounding the instructions with comment markets (/* and */),
          causing the enclosed instructions to become comments. If the error message then disappears, the
          deleted portion of the program contains the source of the error.





                                           LOVELY PROFESSIONAL UNIVERSITY                                   309
   311   312   313   314   315   316   317   318   319   320   321