- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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".
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

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