- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think this is legal Fortran, but IVF didn't complain:
ELSE IF(-25.d0 < CoilInletTemp <=0.0d0) THEN
gfortran did complain.
any comments?
Is this kind of statement legal in c, c++, basic?
(Always trying to figure out where our developers get their syntax).
probably is legal in things like mathlab, Mathematica
Linda
ELSE IF(-25.d0 < CoilInletTemp <=0.0d0) THEN
gfortran did complain.
any comments?
Is this kind of statement legal in c, c++, basic?
(Always trying to figure out where our developers get their syntax).
probably is legal in things like mathlab, Mathematica
Linda
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If a compiler accepts this, it's likely done via the extension where logical expressions can be treated as integer. Even then it looks ambiguous. The behavior isn't lkely to resemble what the author intended, no matter what "language" is in use. Yes, it's probably "legal" in C and C++; I hope not in BASIC. ifort should complain if you set -stand.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This statement is not legal in Fortran. Intel Fortran will accept it, though, via its extension of doing automatic conversion between numeric and logical. It is probably interpreted as:
(23.d0 < CoilInetTemp) <= 0.0D0
where the expression in parentheses yields either a .TRUE. or .FALSE. value. This is then converted to REAL(8) using -1 for .TRUE. and 0 for .FALSE.. If you enable standards checking, it would complain.
This extension has its roots more than three decades ago, but I have been agitating for it to be disabled by default. I will bring this up again.
(23.d0 < CoilInetTemp) <= 0.0D0
where the expression in parentheses yields either a .TRUE. or .FALSE. value. This is then converted to REAL(8) using -1 for .TRUE. and 0 for .FALSE.. If you enable standards checking, it would complain.
This extension has its roots more than three decades ago, but I have been agitating for it to be disabled by default. I will bring this up again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Steve Lionel (Intel)
If you enable standards checking, it would complain.
This extension has its roots more than three decades ago, but I have been agitating for it to be disabled by default. I will bring this up again.
This extension has its roots more than three decades ago, but I have been agitating for it to be disabled by default. I will bring this up again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree -- see no reason for allowing that.
I did not see if CVF accepted it. gfortran said "junk". did not check g95 with it either (yet).
in any case, i don't think the compiler is going to do what the developer intended/wants.
Thanks.
Linda
I did not see if CVF accepted it. gfortran said "junk". did not check g95 with it either (yet).
in any case, i don't think the compiler is going to do what the developer intended/wants.
Thanks.
Linda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Obviously it's legal Fortran, and a bug for gfortran to reject it.
[bash]module M implicit none type T end type T interface operator(<)
module procedure op end interface operator(<) interface operator(<=) module procedure op2 end interface operator(<=) contains function op(x,y) double precision, intent(in) :: x type(T), intent(in) :: y double precision op op = -1 end function op function op2(x,y) type(T), intent(in) :: x double precision, intent(in) :: y double precision op2 op2 = -1 end function op2 end module M program P use M implicit none type(T) CoilInletTemp IF(.FALSE.) THEN ELSE IF(-25.d0 < CoilInletTemp <=0.0d0) THEN write(*,*) 'Test successfully passed.' END IF end program P [/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Harumph. Yes, if you define your own operators it can be legal, but I have to assume that wasn't done in Linda's example.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page