Xref: utzoo comp.lang.c:17616 comp.lang.fortran:1931 Newsgroups: comp.lang.c,comp.lang.fortran Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: fortran to C converter Message-ID: <1989Apr13.173331.2116@utzoo.uucp> Organization: U of Toronto Zoology References: <1992@csd4.milw.wisc.edu> <11926@lanl.gov> Date: Thu, 13 Apr 89 17:33:31 GMT In article <11926@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >...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 > >... I've not heard that inlining is available on >any C++ presently marketed. In any sensible implementation of "complex" in any sensible C++ compiler, that code will get inlined, because the declarations of the = and * operators (in a .h file, usually) will contain the definitions and the compiler will therefore inline them. No procedure calls needed. Nobody would use C++ if everything required procedure calls, as is the case in all too many other object-oriented languages. C++ has a lot of warts; the ability to produce efficient code is what's won it so many friends in spite of its problems. If you want general inlining without having to carefully ask for it, that's harder, and it probably is true that existing compilers don't do it, for the same reason that most C and Fortran compilers don't: in the general case, it's hard. -- Welcome to Mars! Your | Henry Spencer at U of Toronto Zoology passport and visa, comrade? | uunet!attcan!utzoo!henry henry@zoo.toronto.edu