Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!news.cs.indiana.edu!iuvax!copper!templon From: templon@copper.ucs.indiana.edu (jeffrey templon) Newsgroups: comp.lang.misc Subject: Re: Fortran vs. C for numerical work Message-ID: <77320@iuvax.cs.indiana.edu> Date: 9 Dec 90 21:43:04 GMT References: <18016@hydra.gatech.EDU> <16671@csli.Stanford.EDU> <77124@iuvax.cs.indiana.edu> <1990Dec9.040635.12696@actrix.gen.nz> Sender: news@iuvax.cs.indiana.edu Organization: Indiana University, Bloomington IN. Lines: 29 In article <1990Dec9.040635.12696@actrix.gen.nz> Bruce.Hoult@bbs.actrix.gen.nz writes: >That's a turn-around! I forget the exact syntax (haven't used FORTRAN for a >decade), but can't you do this in FORTRAN? > > IF(a) 1111,1112,1113 >1111 b = sqrt(-1.0*a) > GO TO 1114 >1112 b = 0 > GO TO 1114 >1113 b = sqrt(a) >1114 CONTINUE Yeah, you could, but I wouldn't recommend it. Not many FORTRAN programmers I know do this anymore, at least if they are writing new code as opposed to modifying old code. If this was all you could do in fortran (maybe it is in fortran 77, but vax fortran allows if-then-else) then I would agree that there was real reason to migrate to C. >In C or Pascal you could allocate a structure as a global (static) variable, >assign your parameters into it and just pass a pointer to the structure to >the called routine. The compiler might even be smart enough to use CALLG, >but in any case the CALLS will be much faster pushing only one parameter. Defeats the purpose. The way it is with vms fortran, you just write a normal subroutine call. Easy. If I really wanted to trade extra work for speed, I'd write in assembler ... jeff