Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!almaak.usc.edu!ajayshah From: ajayshah@almaak.usc.edu (Ajay Shah) Newsgroups: comp.lang.fortran Subject: Re: f2c experiences? Message-ID: <28393@usc> Date: 25 Nov 90 23:57:24 GMT References: <1990Nov25.204354.12324@ariel.unm.edu> Sender: news@usc Organization: University of Southern California, Los Angeles, CA Lines: 69 Nntp-Posting-Host: almaak.usc.edu In article <1990Nov25.204354.12324@ariel.unm.edu> john@ghostwheel.unm.edu (John Prentice) writes: (a situation where f2c-generated code doesn't work on a Sun3) >If this is typical of the reliability of f2c (assuming I didn't >just make a dumb mistake somewhere), then I would say it is >a ways from being a production tool for porting Fortran to C. I think this is not typical. Make-ing f2c is slightly nontrivial; I had a few false tries on a Sparcstation before getting it right. I wish hints on getting the f2c system to work on a given machine are better documented. Maybe comp.lang.fortran can put together user notes on f2c in this spirit? Another point you should probably note is that f2c is a *very* dynamic program, there are changes and bugfixes to the source every week or so. Your problem may well be a bug which has been fixed in case you're using an old f2c system. >I have had some success in the past using f2c to convert Fortran >to C, though on one test it expanded a 50 line Fortran program >to nearly 1000 lines (the code was a simple Fortran parser). >I can accept that however given that the conversion of i/o routines >is not that easy and C lacks most of the string handling >ability of Fortran. What are other peoples experience with >f2c? I'm not used to thinking of fortran as being a place to do string handling! :-) Translation of tacky fortran-I/O is definitely a challenge, and I'm not surprised that f2c comes up with strange-looking code in such situations. Maybe I'm lucky. I write fortran which is just a set of clean control structures (never used an arithmetic if or a computed goto in my life) with minimal use of strange fortran I/O and weird common/equivalence tricks. My code looks a lot like pascal given the liberal use of Sun fortran extensions (like label-free do loops and "implicit undefined (a-z)") and liberal use of /usr/lib/cpp. At the end of the day, I could easily translate my code to Pascal or C by hand, and find f2c to be a useful crutch in such translation. As for the tragic piles of dusty-decks lying around, f2c generates correct code as far as I can tell and I never look at the generated C. It was rotten code to start with, and the generated C is no better. Anytime I need to make changes on code in fortran-66 or so, I just throw it away and rewrite from scratch. It's hard, but life is tough! >By the way, this note is not meant as a criticism of the people >working on f2c. I think this is an excellant project and the >need for a good Fortran to C converter is great. It is meant >more to find out if we are anywhere near that goal and to suggest >that it may be a bit premature to suggest abondoning Fortran for >numerical work if you need the existing math libraries. In the spirit of the above, I think f2c *has* solved my problem of leaving fortran! If there are bugs, and I don't doubt there are many, they need to be ironed out. The fundamental philosophy of f2c is perfectly on track, IMHO. We urgently need to get scientific computing out of fortran and into Pascal/C. Users of f2c all around are chipping away at this larger goal everyday. -- _______________________________________________________________________________ Ajay Shah, (213)734-3930, ajayshah@usc.edu The more things change, the more they stay insane. _______________________________________________________________________________