Re: IARGC when using IMPLICIT NONE

"Andy Vaught" <[email protected]> Wed, 12 May 2004 10:35:33 -0700 (MST)
Newsgroups gmane.comp.compilers.g95
Message-ID <Pine.LNX.4.21.0405121035080.1057-100000@mjolnir>
On Tue, 11 May 2004, John Spray wrote:

> Hi,
> 
> I'm new to g95, and I'm having some confusion with the behaviour of the 
> intrinsic function iargc.  Please forgive me if I'm missing something 
> obvious, since I'm by no means a F90 expert.
> 
> 1.
> """
> program foo
>          print *, iargc()
> end program foo
> """
> Works fine.
> 
> 2.
> """
> program foo
>          IMPLICIT NONE
>          print *, iargc()
> end program foo
> """
> 
> Says "Error: Function 'iargc' at (1) has no implicit type"
> 
> This confuses me: I can use the intrinsics for cos and sin without 
> declaring them, even when I use IMPLICIT NONE.  How is iargc different 
> in this respect?
> 
> 3.
> """
> program foo
>          IMPLICIT NONE
>          INTEGER,INTRINSIC :: iargc
>          print *, iargc()
> end program foo
> """
> 
> Says
> """
> INTEGER,INTRINSIC :: iargc
>                            1
> Error: Intrinsic at (1) does not exist
> """
> 
> What would be the correct way to declare this?

  iargc() is implemented as an external.  So:

program foo
    IMPLICIT NONE
    INTEGER, EXTERNAL :: iargc
    print *, iargc()
end program foo


         Andy



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver
higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3