Path: utzoo!attcan!uunet!husc6!cmcl2!rutgers!gatech!emory!platt From: platt@emory.uucp (Dan Platt) Newsgroups: comp.lang.fortran Subject: Re: Fortran vs C for computations Message-ID: <3169@emory.uucp> Date: 8 Sep 88 04:52:01 GMT References: <962@amelia.nas.nasa.gov> <3290@lanl.gov> Reply-To: platt@emory.UUCP (Dan Platt) Organization: Emory University Lines: 30 >#ifdef is an admission that your compiler isn't any good. If the >conditional expression is a constant, a normal if statement should >be optimized so that code is only generated for the active branch. If >the conditional expression is not a constant, it couldn't be used as >part of an #ifdef either. I object to this argument. There are some functions provided in certain environments that are not provided in other environments (specifically, functions that deal with dates, times, extended function sets such as error functions or Bessel functions) or which exist but have different forms on each system. The biggest problem concerns 'open' statements which seem to be very system specific; I don't believe that an IF with a constant expression would let that by, even if the final code generation included the non-compatible code. A pre-processed #ifdef would clean up that problem. It would also provide a clean, convenient way to document the portability constraints of the program. For example, in the PC world, some routines may be more efficiently compiled if there is no Color card than if there is (problems with raster syncs). The easiest way to code this is to include a function definition in C without the color card, and to use an assembler routine version if the color card is there. The inclusion in the module would depend on the presence of the card. (An even more sophisticated version would check the flag at each entry, or load the correct overlay for the routine at run-time). One of the biggest problems I've been confronted with lately is the portability problems of Fortran. I find C much more portable, and the new ANSI standards seem to be encouraging portability even more. I haven't had the opportunity to use 8X (will soon though), so I cannot comment on the features provided there. Dan