Sunday, May 13, 2007

Using and Porting GNU Fortran

System Intrinsic (function)

System(Command)

System: INTEGER(KIND=1) function.

Command: CHARACTER; scalar; INTENT(IN).

Intrinsic groups: badu77.

Description:

Passes the command Command to a shell (see system(3)). Returns the value returned by system(3), presumably 0 if the shell command succeeded. Note that which shell is used to invoke the command is system-dependent and environment-dependent.

Due to the side effects performed by this intrinsic, the function form is not recommended. However, the function form can be valid in cases where the actual side effects performed by the call are unimportant to the application.

For example, on a UNIX system, `SAME = SYSTEM('cmp a b')' does not perform any side effects likely to be important to the program, so the programmer would not care if the actual system call (and invocation of cmp) was optimized away in a situation where the return value could be determined otherwise, or was not actually needed (`SAME' not actually referenced after the sample assignment statement).


No comments: