- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran has a (very) nifty language extension that allows an edit descriptor to be an integer expression, using the < > brackets has shown in the subject line above. But is there a standard compliant equivalent form or workaround?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The standard-compliant way is to write the format into a character variable and then use that variable as the format. That extension, Variable Format Expressions, dates back to the DEC PDP-11 days and has earned us the enmity of lots of other compiler developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A one-line possibility is
WRITE(*,'(2A)') REPEAT(' ',my_var), my_text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Repeat Offender for the elegant solution.

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