home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.fortran:4279 comp.sys.hp:12793
- Newsgroups: comp.lang.fortran,comp.sys.hp
- Path: sparky!uunet!utcsri!helios.physics.utoronto.ca!alchemy.chem.utoronto.ca!system
- From: system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson))
- Subject: Re: Weird HP compiler warning
- Message-ID: <1992Nov11.174048.2873@alchemy.chem.utoronto.ca>
- Organization: University of Toronto Chemistry Department
- References: <1992Nov10.193635.2736@alchemy.chem.utoronto.ca> <1992Nov10.210300.2732@leland.Stanford.EDU>
- Date: Wed, 11 Nov 1992 17:40:48 GMT
- Lines: 33
-
- In article <1992Nov10.210300.2732@leland.Stanford.EDU> ungar@leland.Stanford.EDU (Jeffrey Ungar) writes:
- >In article <1992Nov10.193635.2736@alchemy.chem.utoronto.ca> mroussel@alchemy.chem.utoronto.ca (Marc Roussel) writes:
- >>
- >> double precision h,nexth,err,d2fex
- >> h = 1.d0
- >> err = 10.d0
- >> d2fex = 123.d0
- >> nexth = min(h,sqrt(12.d0*err/d2fex))
- >> write(*,*)nexth
- >> END
- >>
- >>For this piece of code, the compiler produces the warning
- >>
- >>Warning on line 5 of weird.f: Argument has same name as INTRINSIC function
- >
- >That's because it looks (almost) like you are trying to pass a function,
- >namely the intrinsic function SQRT, to the MIN() function. Of course, if
- >you *really* wanted to use SQRT as a subprogram argument, you would
- >declare it in an INTRINSIC statement, and just write the name "SQRT" in
- >the argument list (but not, I would suggest, to the MIN routine!)
-
- If the compiler thinks that an expression in a argument list (even if
- it involves a function call) is going to pass anything but the returned
- value, then the compiler is truly confused - you can't pass things like
- that. The code should be precisely equivalent to
- xjunk = sqrt(12.d0*err/d2fex)
- nexth = min(h,xjunk)
- To pass a function name to a called routine, you can't have any
- arguments, and you better have declared it EXTERNAL so the compiler
- knows you are passing a subprogram name, not a variable.
- --
- What are the chances that any HP computer system will ever "work" properly?
- ... and Slim just left town. -*- Mike Peterson, SysAdmin, U/Toronto Chemistry
-