Where should the type information be 223
Where should the type information be 224
Yes, I know. In this newbie day and age, I try to signify which FORTRAN I'm talking about by using the spelling. Sometimes...
The function was recognized as essential in numerical mathematics, for which FORTRAN was invented. BTW, the original language is all caps, but the later versions are normally written with the F only capitalized. The character set was restricted to 48 characters, including spaces, and some of the keypunch characters had to be changed to allow formulas. The use of ** for exponentiation was because everything else available had been used. The function did consider the types of the arguments, but also optimizing used the actual values if they were fixed, or computable at compile time.
Where should the type information be 226
Whoa! You are talking about a philosophy; I'm talking about where I, the compiler, would place the bits you told me...
But a function call has high overhead; replacing X**#3 by X*X*X has no run-time overhead and one compile-time evaluation. How much optimization is provided depends on the usual evaluations of situations. Putting this in a function call requires the compiler to look not only at the types of the arguments, but for possible information about the values, at compile time. With unrolling loops, a compile-time variable may become even a compile-time constant, and further simplification can occur.
If an operator is defined, it will be necessary to tell the compiler what to do with it, just as if a function is defined, it must be in the library. C does not, but C++ allows the compiler to look at the types of the arguments of a function at compile time, as is specified by the user. For operators, one can also specify how it is to treat special values of the arguments. -- This address is for information only. I do not claim that these views are those of the Statistics Department or of Purdue University. Herman Rubin, Department of Statistics, Purdue University