fortran to C converter

Jim Giles jlg at lanl.gov
Thu Apr 13 06:21:18 AEST 1989


>From article <1992 at csd4.milw.wisc.edu>, by zdenko at csd4.milw.wisc.edu (Zdenko Tomasic):
> In article <158 at np1.hep.nl> t19 at np1.hep.nl (Geert J v Oldenborgh) writes:
>>Just out of curiosity, how are (double) complex variables translated to C?
> 
> Consider C++, since it  can  define them as objects being object-oriented
> language.

The problem with this is that all the primitive operations on 'objects'
in C++ is done with procedure calls.  So the translation of the following
would contain two procedure call overheads:

      COMPLEX A,B,C
      ...
      A=B*C

There would be a procedure call for each of the primitive operations
(multiply and assignment).  This is hardly what I have in mind when I 
use complex variables.

Of course, there's nothing in the C++ definition that _requires_ that
all functions be implemented externally.  The problem is that the 'inlining'
requires the source (or some intermediate form) of the function library
to be present at compile time.  This would mean (for example) that you
couldn't market a package which implements COMPLEX as 'objects' without
distributing the source.  I've not heard that inlining is available on
any C++ presently marketed.

Actually, C++ 'objects' aren't really objects (as in SmallTalk et.al.),
but the mechanism is really a restricted form of dynamic function overloading.
Genuine function overloading is more general, easier to understand, and could
be just as efficient.



More information about the Comp.lang.c mailing list