From: Elijah Cardon on 24 Oct 2006 18:59 One of the reasons that I use #define in c is that it mimics what might happen if a caller were passing what is being #defined. Is there such a thing as a preprocessor in fortran? EC
From: Kamaraju Kusumanchi on 24 Oct 2006 21:23 Elijah Cardon wrote: > One of the reasons that I use #define in c is that it mimics what might > happen if a caller were passing what is being #defined. Is there such a > thing as a preprocessor in fortran? EC > > I use cpp as the preprocessor on Debian Etch for fortran 90 programs. raju
From: Tim Prince on 24 Oct 2006 21:25 Elijah Cardon wrote: > One of the reasons that I use #define in c is that it mimics what might > happen if a caller were passing what is being #defined. Is there such a > thing as a preprocessor in fortran? EC > > Many Fortran compilers come with a pre-processor which implements #define, although it's not part of the standards. On linux-like systems, source files named with .F or .F90 typically cause the pre-precessor to be invoked, or a command line option which invokes pre-processing is available. If all else fails, a common tactic is gcc -x c -traditional -E yourfile.f > preprocessedfile.f Several preprocessors of similar nature are available as open source. Pre-processors closer to the standard, although not in as widespread use, have similar functionality. I don't recognize your description of the usage of pre-processing.
From: AeroSpace Ed on 25 Oct 2006 05:08 Elijah Cardon wrote: > One of the reasons that I use #define in c is that it mimics what might > happen if a caller were passing what is being #defined. Is there such a > thing as a preprocessor in fortran? EC This doesn't make any sense to me. What EXACTLY are you using the #defined directive for? Many Fortran compilers can pre-process cpp statements. However, your described use doesn't make any sense to me. Ed
From: Tobias Schlemmer on 25 Oct 2006 08:16 AeroSpace Ed schrieb: > Elijah Cardon wrote: > >> One of the reasons that I use #define in c is that it mimics what might >> happen if a caller were passing what is being #defined. Is there such a >> thing as a preprocessor in fortran? EC > This doesn't make any sense to me. What EXACTLY are you using the #defined > directive for? Many Fortran compilers can pre-process cpp statements. One interesteing application of #define is IMHO the C/C++ macro assert, which assures a given expression. In the failure case it will stop your program and output the current filename and line number together with the test to stderr. One problem I have with g95: The macro expansion very often exeeds the > However, your described use doesn't make any sense to me. Using autoconf is a very useful example. or e. g. #ifdef DEBUG #define pure #endif That enables you to have some debug output in otherwise pure functions if you are familiar with the side effects. Tobias
|
Next
|
Last
Pages: 1 2 Prev: ABSOFT FORTRAN v10 COMPILER Next: Bus error/ segmentation fault--help? |