This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OT] cure for nasty #ifdef's?


On May 24 2012, Salvatore Filippone wrote:
On Wed, 2012-05-23 at 19:09 -0400, Tom Roche wrote:

Regarding 2: is there an alternative to the preprocessor? E.g.: I spent a long time coding java; in a similar circumstance there, I'd try AspectJ or other vehicle for aspect-oriented programming. I believe there are attempts at AOP for C++, but know of nothing for fortran. Am I missing something?

This example really cries out for object-oriented techniques. And, given the likely amount of work performed in VDIFF, the performance penalty at runtime should be neglibible.

I disagree with the first sentence, though it is unquestionably one of the better ways to resolve this issue - what I disagree is with the implication that it is THE best one (i.e. it may or may not be). I fully agree with the second sentence.

Sorry, but to be blunt, the root fault with all such programs is that
they are badly engineered.

As soon as a program uses a preprocessor or (yuck) autoconfigure for
more than one or two small, well-encapsulated modules that deal with
intrinsically system-dependent facilities or bypass implementation bugs,
it is both both poorly structured and highly non-portable.  Modern
Fortran (and gfortran, for quite a long time) provide quite enough
tools that almost all of the code should be entirely free of such
abominations.

I agree that the OP would be well advised to look at courses that
describe how to do this in modern Fortran, especially modules, object-
orientation and just possibly polymorphism.  THOSE are the right
approaches to resolving this issue properly.


Regards, Nick Maclaren.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]