In the Fortran version, each TAO routine has as its final argument
an integer error variable, in contrast to the C++ convention of
providing the error variable as the routine's return value. The error
code is set to be nonzero if an error has been detected; otherwise, it
is zero. For example, the Fortran and C++ variants of TaoSolveApplication() are
given, respectively, below, where info denotes the error variable:
call TaoSolveApplication(TAO_APPLICATION taoapp, TAO_SOLVER tao, int info) info = TaoSolveApplication(TAO_APPLICATION taoapp, TAO_SOLVER tao)
Fortran programmers can use the error codes in writing their own
tracebacks. For example, one could use code such as the following:
call TaoSolveApplication(taoapp, tao, info) if (info .ne. 0) then print*, 'Error in routine ...' return endifIn addition, Fortran programmers can check these error codes with the macro CHKERRQ(), which terminates all process when an error is encountered. See the PETSc users manual for details. The most common reason for crashing PETSc Fortran code is forgetting the final info argument.
Additional interface differences for Fortran users: