Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
8 Views

How to disable automatic gray(comment) region?

Hello,

I'm using visual studio 2017 and parallel studio xe2018(ver 15.7.5)

Sometimes some part of my code exceeding certain length limit automatically becomes comment with gray region.

Example:

example.png

This makes me change the code to new line, which is very inconvenient.

I wonder why this kind of function exists, and how to disable this??

Thanks.

 

 

0 Kudos
4 Replies
Highlighted
Black Belt
8 Views

This issue you describe is

This issue you describe is caused by using Fixed Format source files (i.e. .for)

If you change to using free format (.f90) then you can use up to 132 characters per line.

Before you make this change, however, I suggest that you look up how free format files manage continuation lines and comments ...

e.g. use of & for continuations, no flag in column 6 on next line

Comments use ! instead of C in column 1.

 

0 Kudos
Black Belt
8 Views

If you have fixed format

If you have fixed format source and you want to use source code that uses more than 72 columns, look into the /extend-source compiler option.

Note, however, that this is a non-standard feature and using a different compiler may make your code malfunction -- what you see in the editor and what the compiler sees may be two different things.

0 Kudos
Highlighted
Beginner
8 Views

 

 

You asked why this feature exists.  This goes way back to the early days of programming when programs were kept on decks of 80 column punch cards.  In those days column 73 through 80 were reserved for card numbering.  Found one of my old bits of code that still has artifacts from this era:

      

      SUBROUTINE  RESO9(PLNTCP,R,DUR)                                   00000010
C                                                                       00000020
C**********************************************************************C00000030
C                                                                      C00000040
C     RESO9                                                            C00000050
C                                                                      C00000060
C       SUBROUTINE RESO9 CALCULATES HYDROPOWER CHARACTERISTICS         C00000070
C       FOR FT PATRICK HENRY, CHEOAH, CALDERWOOD, CHILHOWEE,           C00000080
C       APALACHIA, OCOEE3, OCOEE2, OCOEE1.                              00000090

If you happened to drop your card deck, there were machines that could put your deck in order based on these card numbers.  The code shown here was actually developed in the 1980's and was stored as a file on the IBM mainframe. The line editors available at the time (I used QED, mostly) still kept line numbers in columns 73 through 80.


 

 

 

 

 

 

 

 

 

0 Kudos
Highlighted
New Contributor I
8 Views

Thanks for your nice comments

Thanks for your nice comments. I was always curious about that.

Thanks alot!!

0 Kudos