Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site jade.BERKELEY.EDU Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!jade!ucbopal!jerry From: jerry@ucbopal.berkeley.edu (Jerry Berkman) Newsgroups: net.lang Subject: Re: [Really: C builtin functions?] Message-ID: <563@jade.BERKELEY.EDU> Date: Tue, 15-Apr-86 20:59:40 EST Article-I.D.: jade.563 Posted: Tue Apr 15 20:59:40 1986 Date-Received: Fri, 18-Apr-86 05:37:35 EST Sender: usenet@jade.BERKELEY.EDU Reply-To: jerry@ucbopal.UUCP (Jerry Berkman) Organization: University of California, Berkeley Lines: 37 Keywords: C >In article <149@diablo.ARPA> avg@diablo.UUCP (Allen VanGelder) writes: >>I think there may be a confusion in terminology between built-in and >>in-line. In FORTRAN, MAX is expanded in-line, so you always get >>FORTRAN's MAX. But SIN is not, and if you jiggle your libraries >>properly you will get your personal SIN function. The same is true >>for READ and WRITE in FORTRAN. >> >>I still call SIN, READ, and WRITE built-in in any language where the >>language manual tells how to use them and what they do. Not true. Try this program on with a 1977 standard compiler: print *, sin(1.0) end function sin(x) sin = 2.0 end When I compile it and run it on 4.3 BSD UNIX, I get: 0.841471 sin() is an intrinsic listed in the standard, and you get it even if there is a Fortran function you wrote with a similar name. If you want your own function instead, you must say: external sin and then sin() is no longer treated as an intrinsic in that program unit. If you write in assembler or C, you can create names to fake out the Fortran standard, but not if you stay within Fortran. By contrast, if you see sin(), or strcmp() or printf() in a C program, there is no way of telling if that is refering to the commonly referenced library routine or the program's author's own personal function. - Jerry Berkman Academic Computing Services U. C. Berkeley (415) 642-4804 jerry@ucbopal.Berkeley.EDU