- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There seems to be a change in behaviour with the '*' format in internal write statements. Is this intentional?
In particlar, the following code executes differently (and in my view incorrectly) with XE Update 1 from the behaviour under CVF or IVF 9 through to 11:
[fxfortran]program Console1
integer (4), automatic :: k
character (8), automatic :: String
String = ' '
! The following internal write statements are fine
write(String,'(A)')'ABCD'
write(*,*)((':',String(k:k)),k=1,5),':'
write(String(1:2),'(A)') 'E'//'F'
write(*,*)((':',String(k:k)),k=1,5),':'
write(String(3:4),'(A,A)') 'G','H'
write(*,*)((':',String(k:k)),k=1,5),':'
! The following has an incorrect leading space
String = 'XXXXX'
write(String,*)'ABCD'
write(*,*)((':',String(k:k)),k=1,5),':'
! The leading space causes the following to fail
write(String(1:2),*)'EF'
write(String(3:4),*)'G','H'
end program Console1
[/fxfortran]
Is it that the internal write is now putting Fortran carriage control characters in the first character with the '*' format? Can this be turned off globally?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The leading space is required by the standard for list-directed output. If we were not putting one in there before, it was a bug. The exact wording of the standard is "Except for continuation of delimited character sequences, each output record begins with a blank character."
I strongly recommend against using list-directed formatting when you care about the exact formatting.
I strongly recommend against using list-directed formatting when you care about the exact formatting.
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