Dear Colleagues,
Could anyone of you tell me if it is allowed to use the same name for
a Contruct name and a variable name (in the same scoping unit of course).
I have been searching the F90 Standard (14.1) and A&B&M&S&W's book "Fortran
95 Handbook",
but could not find a clear answer to this question.
Is there a difference between F90 and F95.
If this is (not) allowed, please tell me where this is hidden in the
documentation.
>From different compilers I get contradicting results:
! [JvO] 2000-08-09 IF.f90
program T_IF
k = 1 ; if = 2
if: if(if > 3) then
else
end if if
end program T_IF
ONE>>> D:\FORTRAN\CURSUS\F90\5>ftn95 if.f90
[FTN95/WIN32 Ver. 2.00 Copyright(c) Salford Software Ltd 1993-2000]
Licensed to: Mr J. van Oosterwijk
Organisation: TU DELFT
0005) if: if(if > 3) then ! IF
WARNING - This construct label is the same name as a Fortran keyword -
possible misplaced ':'
0003) k = 1 ; if = 2
WARNING - Variable 'K' has been given a value but never used
NO ERRORS, 2 WARNINGS [<T_IF> FTN95/WIN32 v2.00]
TWO>>> D:\FORTRAN\CURSUS\F90\5>f90 -c if.f90
cf90-558 error on line 5 of if.f90: "IF" has been used as a variable,
therefore
it must not be declared as a construct-name.
f90: Copyright Absoft Corporation 1994-1998 mV2; Cray Research, Inc.
1994-1996 C
F90 (2.x.x.x f36t87) Version 2.0 Wed Aug 9, 2000 16:10:55
f90fe: 11 source lines
f90fe: 1 Errors, 0 Warnings, 0 Other messages, 0 ANSI
After that a new try:
! [JvO] 2000-08-09 IF2.f90
program T_IF
k = 1
!! IF not declared !!
if: if(if > 3) then
k = -1
else
k = 0
end if if
end program T_IF
D:\FORTRAN\CURSUS\F90\5>f90 -c if2.f90
[FTN95/WIN32 Ver. 2.00 Copyright(c) Salford Software Ltd 1993-2000]
Licensed to: Mr J. van Oosterwijk
Organisation: TU DELFT
0005) if: if(if > 3) then
WARNING - This construct label is the same name as a Fortran keyword -
possible misplaced ':'
WARNING - Variable 'IF' has been used without being given an initial value
0003) k = 1
WARNING - Variable 'K' has been given a value but never used
NO ERRORS, 3 WARNINGS [<T_IF> FTN95/WIN32 v2.00]
D:\FORTRAN\CURSUS\F90\5>f90 -c if2.f90
tmod-2612 INTERNAL : Internal: IR xlate; SOURCE line: 5, file: if.f90;
INTERNAL
site: 1341, tag: 0, val: -1
tmod-2612 INTERNAL : Internal: IR xlate; SOURCE line: 5, file: if.f90;
INTERNAL
site: 1341, tag: 0, val: -1
tmod-2612 INTERNAL : Internal: IR xlate; SOURCE line: 5, file: if.f90;
INTERNAL
site: 15950, tag: 0, val: -1
--
Meilleures Salutations,
Kindest Regards,
/---
Jan van Oosterwijk
Computing Centre
Delft University of Technology
Postbus 354
2600 AJ Delft
Netherlands / Pays-Bas
mailto:[log in to unmask]
Phone: +31 15 278 50 17
Fax: +31 15 278 37 87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|