- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
コピーされたリンク
6 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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]
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
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.
