VMS Help FORTRAN, Statements, Directive Statements, ASSERT *Conan The Librarian (sorry for the slow response - running on an old VAX) |
CDEC$ ASSERT (log-exp) or in statement form: ASSERT (log-exp) log-exp Is a logical expression. The ASSERT directive (also available in statement form) provides the compiler with information to improve optimization (particularly if vectorization or automatic decomposition for parallel processing is being performed). The directive can also be used to provide a form of error checking in user applications. The ASSERT directive tells the compiler that "log-exp" evaluates as .TRUE. at the location in the program unit where the ASSERT appears. If the compiler option /CHECK=ASSERTIONS (or OPTIONS/CHECK=ASSERTIONS) is in effect, the compiler adds run-time code to verify the asserted expression; if the expression evaluates as .FALSE., a run-time error is signaled. The following is an example of how to use the CDEC$ ASSERT directive for error checking (the program is compiled using the compiler option /CHECK=ASSERTIONS: CDEC$ ASSERT (ICOUNT .NE. 0) IVAL = IVAL / ICOUNT ! Avoid zero-divide exception
|