I do avoid selected_real_kind(), etc. for just the reason Van Snyder mentions - that is the ambiguity I referred to. I'm afraid I don't follow how the "gluing together" works, though. I understand one can have two versions of the algorithm in the body, and branch based on the (integer) kind value, but how do you work it so your generic has only one set of dummy arguments? If the dummy arguments in the library routine are for a given kind (say sp = kind(0.0)), and the values you attempt to pass in are of a different kind (say dp = kind(1.0d0), the compiler will bark. This issue stymied me when I tried it, long ago. Alvaro Fernandez -----Original Message----- From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of [log in to unmask] Sent: Monday, March 08, 2004 1:41 PM To: [log in to unmask] Subject: Re: configurable default real Alvaro Fernandez <[log in to unmask]> wrote: > .... (The trick is that I _never_ overload based > on kind - too easy to create ambiguities.) .... It's trivial to avoid ambiguities. The standard requires that default real and double precision are different kinds. So I write a real version and a double precision version of each library procedure, and glue them together to make a generic. I use kind(0.0e0) and kind(0.0d0) to get the kind numbers, and then frequently use "include" so as not to need to write the body twice. I agree that trying to do generic resolution based on selected_real_kind is an invitation to portability problems. Therefore I **never** use selected_real_kind to get the kind numbers for generic resolution, because selected_real_kind(6) and selected_real_kind(12) might be the same kind. That's the source of the ambiguity that may be the one Alvaro is trying to avoid. If the program author specifies kinds by reference to precision requirements, which are in turn derived from physical properties of the problem at hand, there may be variables that are the same kind on some platform, and different kind on another platform, but the processor ultimately can figure out which one of a single/double generic to use. -- Van Snyder | What fraction of Americans believe [log in to unmask] | Wrestling is real and NASA is fake? Any alleged opinions are my own and have not been approved or disapproved by JPL, CalTech, NASA, Sean O'Keefe, George Bush, the Pope, or anybody else.