- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
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
Ссылка скопирована
2 Ответы
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
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".
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
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

Ответить
Параметры темы
- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати