Keywords (or #pragma's) for program transformation

Alan Watson <>
Fri, 17 Apr 1992 22:16:38 GMT

          From comp.compilers

Related articles
Keywords (or #pragma's) for program transformation (1992-04-17)
Keywords (or #pragma's) for program transformation (Alan Watson) (1992-04-17)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Alan Watson <>
Keywords: optimize, design
Organization: Compilers Central
References: 92-04-073
Date: Fri, 17 Apr 1992 22:16:38 GMT (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".

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.