home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!network.ucsd.edu!lyapunov.ucsd.edu!mbk
- From: mbk@lyapunov.ucsd.edu (Matt Kennel)
- Newsgroups: comp.lang.fortran
- Subject: Re: Small Language Wanted
- Date: 27 Aug 1992 23:00:31 GMT
- Organization: Institute For Nonlinear Science, UCSD
- Lines: 55
- Message-ID: <17jmqfINNmrc@network.ucsd.edu>
- References: <9224107.5975@mulga.cs.mu.OZ.AU>
- NNTP-Posting-Host: lyapunov.ucsd.edu
- X-Newsreader: Tin 1.1 PL3
-
- fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
- : No, in principle if the library function in question is a *standard*
- : library function, then its implementation is just a part of the
- : compilation system. When the compiler sees #include <math.h>, it can
- : - read /usr/include/math.h
- : - read foobar.xyzzy
- : - insert the appropriate declarations without reading any file.
- :
- : Furthermore, when it sees
- :
- : pow(a,i)
- :
- : in your code, and "i" happens to be an integer then it can emit code to
- : - call the standard pow() function after convertin
- : i to a double
- : - call a special function the calculates doubles to
- : integer powers
- : - calculate the exponentiation using inline code.
-
- Suppose in foo.c I do the above. Then in pow.c I have my own
- new defintion of "pow" which does something different.
-
- How does C know when compiling foo.c the difference :
-
- cc -c foo.c
- cc -o foo foo.o -lm
-
- vs.
-
- cc -c foo.c
- cc -c pow.c
- cc -o foo foo.o pow.o -lm
-
- ???
-
- Or is this a resolved problem?
-
- Question: Do you know which real live C compilers that people can buy or
- steal which do in fact perform the optimizations that we're talking about?
-
- Say, perhaps, computing pow(x,4) with *TWO* FP multiplications.
-
- I suspect the percentage is about 85% for Fortran, and maybe 10% for C,
- but I really have no idea.
-
- : Fergus Henderson fjh@munta.cs.mu.OZ.AU
- : This .signature virus is a self-referential statement that is true - but
- : you will only be able to consistently believe it if you copy it to your own
- : .signature file!
-
- --
- -Matt Kennel mbk@inls1.ucsd.edu
- -Institute for Nonlinear Science, University of California, San Diego
- -*** AD: Archive for nonlinear dynamics papers & programs: FTP to
- -*** lyapunov.ucsd.edu, username "anonymous".
-