Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28991 Discussions

IARGC() not happy with the -std90 switch

stevenchan
Beginner
776 Views
Hi,
EXTERNAL IARGC
to suppress the warning (#7416) when the code is compiled with the '-std90' switch. Can anyone explain to me why?
Steven
0 Kudos
7 Replies
TimP
Honored Contributor III
776 Views
As Steve Lionel said back then, ifort has been made to recognize IARGC as a non-standard intrinsic. Apparently, this leads to various anomalies when checking standard compliance. EXTERNAL IARGC tells the compiler you don't intend it as an intrinsic. I could read his comment as indicating possibly it should have been defined under USE IFPORT, rather than as something the compiler could recognize without USE IFPORT.
Even more confusing is the conflicting definition of IARGC under USE IFPOSIX.
0 Kudos
stevenchan
Beginner
776 Views
Tim:
Thanks for your reply. I now have 3 questions:
1. Will IARGC eventually find its way in IFPORT?
2. I looked up IFPOSIX, I don't see another IARGC defined there (my ifort is11.0.083).
3. Are the reasons behind making IARGC a non-standard intrinsic specific to ifort only? Do other fortran compilers regard IARGC anon-standard intrinsic as well?
Steven
0 Kudos
TimP
Honored Contributor III
776 Views
You can see with any search engine that the getarg/iargc pair was defined for many compilers prior to the advent of the Fortran get_command_argument. HP, IBM, Sun, .... Then there were others with slight variations in spelling.
g77 treated it as an intrinsic; gfortran moved away from such incompatibility with the standard.
As far as I could tell from my long ago acquaintance with HP Fortran, it wasn't treated as an intrinsic, but was included in libU77 for compatibility with f2c.
I don't see the point in knowing exact details of how various compilers treated IARGC, now that a preferable choice has been available for 8 years or so, so perhaps I haven't answered the question.
0 Kudos
Steven_L_Intel1
Employee
776 Views
May I humbly suggest that you drop IARGC and use COMMAND_ARGUMENT_COUNT, as Tim hints in his last sentence?

IARGC, as Tim mentions, varies in usage across compilers. We made it an intrinsic in order to be able to resolve the variations without requiring code changes.
0 Kudos
stevenchan
Beginner
776 Views
Steve:
So, is it safe to say that for portability reasons it is better to replace
IARGC withCOMMAND_ARGUMENT_COUNT, and
GETARG withGET_COMMAND_ARGUMENT
?
I assume these new calls are fine as long as the guy next to me has a compiler that understands the Fortran 2003 standard, right?
Steven
0 Kudos
Steven_L_Intel1
Employee
776 Views
Yes - and any compiler worth using implements at least those intrinsics, even if it doesn't have all of F2003 (which ifort doesn't yet.)
0 Kudos
stevenchan
Beginner
776 Views
Thanks Steve and Tim. Your replies were very helpful indeed.
Steven
0 Kudos
Reply