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: pre-processor macro associated with availability of execute_command_line


On 1/2/2012 1:15 PM, Tobias Burnus wrote:
Tim Prince wrote:
As execute_command_line has been available in gfortran for over a year
without penetrating to commonly used targets (e.g. mingw-64), I
wondered if there is a suggestion for pre-processor macro to choose a
source code branch, such as keying on gcc version number.
I suppose if it were easy to back-port to gfortran 4.5, it would have
been done already.

GCC 4.7.0 (including "gfortran -cpp" and "cpp") set (cf. "gfortran -cpp -dM test.F90"): #define __GNUC__ 4 #define __GNUC_MINOR__ 7

The main reason that execute_command_line has not been backported to
older GCC versions is that it is not a regression and not a bug. (The
patch is not very small but rather localized.) Actually, I am surprised
that you are considering a backport: execute_command_line is a Fortran
2008 feature and very few compilers support it. On the other hand, the
vendor intrinsic SYSTEM (either as function or as subroutine - or as
with gfortran: both) is widely supported. (Besides the standard
conformance, the main advantage of execute_command_line is the support
of WAIT=.false., which is often not needed.)

Tobias
Thanks, I was a bit concerned about lack of assurances about system() for various targets, although it clearly works for mingw gfortran:

#if !defined __GFORTRAN__ || __GNUC__ < 4 || __GNUC_ == 4 && GNUC_MINOR < 6
      junk=system("uname -ps > uname.txt")
#else
      call execute_command_line("uname -ps > uname.txt")
#endif


-- Tim Prince


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