I’m trying to maintain an old piece of f77 code, and I’ve come across something of whose meaning I’m unsure. Ordinarily I resolve these problems by Googling, but I’m not even sure what keywords to search on here.
I have a line of code, near the beginning of a subroutine, that reads
DEX(DEXARG)=DEXP(2.302585*DEXARG)
Later in the code, this DEX thing shows up several more times, like so:
EMEI=DEX(EMEIL)
Now, it looks like what this is doing is creating a function called DEX, that’s taking an argument and returning 10 to the power of that argument (the magic number there is the natural log of 10). But I can’t find any documentation on this method of creating a function. Is this what’s actually happening, and if so, what’s this technique called?
This is an “inline fuction”, indeed allowed in FORTRAN 77. It behaves in the way you would expect. It has to come before the first line of executable code (I think), among the variable declarations. Inline functions are dereferenced at compile time.
It’s been a long time since I’ve done 77, but I tried to figure it out, anyway. Then I got the bright idea of looking at the existing responses. Looks to me like Baracus got it. That’s what I was sorta thinking. I second that. But I haven’t even read, let alone written any FORTRAN in well over a decade. My vote is for what Baracus pointed you to. FWIW, which isn’t much.