Re: Informix/4GL REALLY SUCKS
Posted in 1997
>> I am very eager to get to work tomorrow and actually check the docs, but >> it appears that while retint() and retlong() accept 'pass-by-value', >> retflo() demands pass by reference. WHY? I cannot fathom why...If >> anyone has an explanation, I'd love to hear it. Obviously retquote() is >> a special case which would demand the reference and not the value but >> retflo()? > >I do not know why this is the case. > >I am almost certain that the reason is lost in the mists of time -- it is >because of Ancient History. > >If forced to guess, I would say it was related to the days when I4GL had to >be ported to hardware without floating point arithmetic (8086, 80286 -- My guess is that this is a hardware performance issue. Most processors and compilers will optimize for passing of variables if the variable being passed can be contained within a single register. If the value is an short, int, or pointer, then it can be passed in a single register. If it is a float or double, and is being passed by value, then actually what will have to happen is for the compiler to set up a space in the calling functions's frame, copy the variables to that space, set up a pointer table to point to where the variables have been copied to, and then pass the address of the pointer table to the called program. That means that we can't hope for as much compiler optimization if values that won't fit in a single register are passed to functions. Don't know for sure - but that's my guess. . Madison Pruet