- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following line of code screw up my StandardOutput:
write(*, '(a)') i, 'Test123'
The reason is that "i" is an integer which does not appear in the format descriptor.
With the correct Format string '(i,a)' the StandardOutput works like a charm.
I'm using IVF 11.0.072 in Visual Studio 2005 SP1.
Now my question :-)
Is it possible to check the source code for such problems with a compiler setting, warning level or
something like that ?
thx in advance,
senji
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Most Fortran compilers do not check the compatibility of format strings against the items in the I/O list at compile time. This is run by the I/O runtime, and you may get an execution error. Consider why this checking is difficult to do: an I/O list with an implied DO loop or an array item expands to a number of items that is not known at compile time. While your simple case is easy to diagnose at compile time, the compiler writer has to either do the checking adequately for all cases, or not at all. Doing only the easy cases is not acceptable, because users will not know when a missing error message is caused by (i) there being no error or (ii) the compiler not being smart enough to spot the error.
With g95, for example, your program generates the runtime error:
"Fortran runtime error: Expected CHARACTER for item 1 in formatted transfer, got INTEGER."
With g95, for example, your program generates the runtime error:
"Fortran runtime error: Expected CHARACTER for item 1 in formatted transfer, got INTEGER."

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