- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there still no block commnet characters available (as in /* in c) in CVF 6.5?
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran is not C. Fortran has no "block comment". Unlike C, Fortran assumes that each line is a complete statement, unless a continuation indicator is used.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's not hard to write a Visual Studio macro to comment out a selection block in the IDE's editor. The macro can be assigned to a toolbar button or keystroke. I posted an example some time ago.
hth,
John
hth,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stevo,
Your answer surprises me. There is nothing wrong with utility features even if martians thought of it. There is surely frequent need for disabling large sections of the code which can be done with block comments. As it is things are more difficult in fortran since it swtiched from C to ! adding a zillion shift keys to the barrage of keystyrokes to diasble a few consecutive lines.
Even if this is not in f95 standard it could have been implemented as an extension or perhaps the way wordperfect does it by hiding blocks as a "hidden comment" with a "bubble" marker.
Tim
Your answer surprises me. There is nothing wrong with utility features even if martians thought of it. There is surely frequent need for disabling large sections of the code which can be done with block comments. As it is things are more difficult in fortran since it swtiched from C to ! adding a zillion shift keys to the barrage of keystyrokes to diasble a few consecutive lines.
Even if this is not in f95 standard it could have been implemented as an extension or perhaps the way wordperfect does it by hiding blocks as a "hidden comment" with a "bubble" marker.
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim,
Actually, yes, there is something wrong with adding such an extension, where the language already provides an appropriate syntax. It serves to fracture the language and encourage users to write non-portable programs. Our philosophy is to invent extensions very cautiously, and then only when they are "in the spirit of Fortran" Block comments, which would be a radical shift in the way Fortran code is parsed, would not make the cut.
Steve
Actually, yes, there is something wrong with adding such an extension, where the language already provides an appropriate syntax. It serves to fracture the language and encourage users to write non-portable programs. Our philosophy is to invent extensions very cautiously, and then only when they are "in the spirit of Fortran" Block comments, which would be a radical shift in the way Fortran code is parsed, would not make the cut.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I use these VBA Macros:
This saves you having to select: just run the Begin/End around your block.
--
Gerry T.
Option Explicit Sub DECBeginCommentBlock() 'DESCRIPTION: Comment a block of code in a CVF source. dim strFunctionName strFunctionName = ActiveDocument.Selection if strFunctionName = "" Then ActiveDocument.Selection = "!DEC$ IF (.FALSE.)" & vbCrLf end if End Sub Sub DECEndCommentBlock() 'DESCRIPTION: End a comment block in a CVF source. dim strFunctionName strFunctionName = ActiveDocument.Selection if strFunctionName = "" Then ActiveDocument.Selection = "!DEC$ END IF" & vbCrLf end if End Sub
This saves you having to select: just run the Begin/End around your block.
--
Gerry T.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks GT,
Now if I only could figure out what a VBA macro is and where to put it.
Tim deBiped
Now if I only could figure out what a VBA macro is and where to put it.
Tim deBiped
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GT,
Please disregard my hasty posting. I figured out how to use your Macro. I even assigned the smiley faces to begin and end.
As I understand it I run the "begin" macro at the beginning then put the cursor at the end of the block and runthe "end" macro. right?
Is is possible to repalce the strings :"!DEC...." with more a descriptive text?
Thanks again,
Tim
Please disregard my hasty posting. I figured out how to use your Macro. I even assigned the smiley faces to begin and end.
As I understand it I run the "begin" macro at the beginning then put the cursor at the end of the block and runthe "end" macro. right?
Is is possible to repalce the strings :"!DEC...." with more a descriptive text?
Thanks again,
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could do:
!DEC IF (.false) !Begin block
...
!DEC END IF !End block
Ciao,
Gerry T.
!DEC IF (.false) !Begin block
...
!DEC END IF !End block
Ciao,
Gerry T.
![](/skins/images/D2683F18326913BBA0436CB7114DD569/responsive_peak/images/icon_anonymous_message.png)
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