|Keywords (or #pragma's) for program transformation email@example.com.Virginia.EDU (1992-04-17)|
|Keywords (or #pragma's) for program transformation firstname.lastname@example.org (Alan Watson) (1992-04-17)|
|From:||Alan Watson <email@example.com>|
|Date:||Fri, 17 Apr 1992 22:16:38 GMT|
firstname.lastname@example.org.Virginia.EDU (Steven D. Majewski) asks about #pragmas or
keywords for C and Fortran to:
> to indicate whether or not a specific function is a referentially
> transparent function, and therefore can be replaced by remembering a
> previous call. e.g.
> sin(x), cos(x) always return the same value for the same argument.
> rand(), & read() emphatically DO NOT, as do any functions that
> produce side-effects, even when they do return the same value.
In Fortran, of course, many arithmetic functions are "built-in" and the
compiler can do this kind of optimization independently the user. ANSI C
also allows standard library functions to be treated in a different manner
to user-defined functions, so this behaviour is also allowed for
appropriate library functions.
For user declared functions, GNU cc allows the user to provides this
information to the compiler by declaring the return type of a function to
be "const" or "__const".
Return to the
Search the comp.compilers archives again.