- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to get the compiler to warn you when an implicit conversion is taking place.
I am in the process of modernizing a legacy code that stored many values in variables of the wrong type ( ints in reals for the most part), and would
like the compiler to help as much as possible.
for example:
INTEGER :: iVal
REAL :: rVal
rVal = 1 ! should be initialized with 1.0
iVal = rVal ! should be INT(rVal)
rVal = REAL(iVal) ! OK, but why use this stmt...
Thanks
Russ Johns
I am in the process of modernizing a legacy code that stored many values in variables of the wrong type ( ints in reals for the most part), and would
like the compiler to help as much as possible.
for example:
INTEGER :: iVal
REAL :: rVal
rVal = 1 ! should be initialized with 1.0
iVal = rVal ! should be INT(rVal)
rVal = REAL(iVal) ! OK, but why use this stmt...
Thanks
Russ Johns
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No - implicit conversions are part of the Fortran standard. But we've had several requests for such a feature and might add it in the future as part of a set of user-settable rules.
You might look at something like the free FORCHEK tool, which can be very picky if you ask it to.
Steve
You might look at something like the free FORCHEK tool, which can be very picky if you ask it to.
Steve

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