Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
공지
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29286 토론

Evaluation of logical expressions with mixed arguments

OP1
새로운 기여자 III
414 조회수
Hi,

Is it possible to have the compiler warn about the following situation:

...
LOGICAL :: FLAG
...
IF (FLAG == 'yes') THEN
...

In other words: the logical expression is made of a logical and a variable from another type. The compiler probably converts 'yes' into a logical (I suppose this is the same situation as having expressionswhere reals are mixed with integers or other kinds of variables, for instance).

So, is there a way to force the compiler to emit a warning in these situations? Or to prevent the compiler from converting argumentsof an expression based on the nature of the first argument?

Thanks,

Olivier
0 포인트
2 응답
Steven_L_Intel1
414 조회수
Turning on standards checking will warn you about this. There are two things non-standard here. The first is the use of a character literal which is treated as a Hollerith constant in non-character contexts. Then there's the non-standard comparison of a logical to a numeric datatype.

There is not an option to disallow logical-numeric conversions, or one to warn speciifically about those. Both are things already on our "wish list".
0 포인트
OP1
새로운 기여자 III
414 조회수

Ah, excellent, that did the trick. I am glad these are on your wish list - these programming errors can easily fly under the radar.

Thanks Steve!

Olivier

0 포인트
응답