Are you familiar with C++ templates? One could define, and some compiler vendor 
libraries define, functions which work as you describe.
--
Sent from my mobile phone. Please excuse my brevity.

Charles

John Gilmore <[email protected]> wrote:

I am familiar with the inline option. What it does is not what I had
in mind. I should have been more specific. I meant independent C
implementations. IBM C and IBM PL/I share the same optimizing and
code-generation machinery.

A [simple] mathematical example will make the appropriate distinctions clearer.

Consider

declare i signed binary fixed(63,0), ((x, y) real, z complex) decimal
float(16), abs builtin ;
. . .
i = abs(i) ; /* example 1 */
x = abs(x) ; /* example 2 */
y = abs(z) ; /* example 3 */

Example 1 and example 2 are always evaluated by trivial compiled code.
They reduce conceptually to a single machine instruction.

Example 3 is instead evaluated by a library subroutine. Why? Recall
that for complex
z = a + bi, abs(z) = sqrt(a**2 + b**2).

Here, as usual, generic functions employing syntactically identical
constructs are evaluated in datatype- and domain-specific ways. (All
this is of course irrelevant for FORTRAN-like C, which does not have
generic functions.)

John Gilmore, Ashland, MA 01721 - USA

_____________________________________________

For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to