Microsoft KB Archive/109879: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 12: | Line 12: | ||
<div id="TitleRow"> | <div id="TitleRow"> | ||
= <span id="KB109879"></span>BUG: Inline Comment with | = <span id="KB109879"></span>BUG: Inline Comment with "!" Can Act Like a C String = | ||
Line 44: | Line 44: | ||
== SYMPTOMS == | == SYMPTOMS == | ||
A program containing | A program containing "!" (to denote an inline comment) directly following a string constant interprets the "!" as the letter "C" and appends a null character to the string. | ||
</div> | </div> | ||
Line 58: | Line 58: | ||
== MORE INFORMATION == | == MORE INFORMATION == | ||
String values in the C language are terminated with null characters. This type of string is specified in Microsoft FORTRAN by using a standard string constant followed by the character C. The code sample below shows how unwanted null characters are appended to string constants with | String values in the C language are terminated with null characters. This type of string is specified in Microsoft FORTRAN by using a standard string constant followed by the character C. The code sample below shows how unwanted null characters are appended to string constants with "!" directly following. | ||
=== Sample Code === | === Sample Code === | ||
Line 66: | Line 66: | ||
WRITE(1, '(A)') 'Normal C string'C ! The C following the string | WRITE(1, '(A)') 'Normal C string'C ! The C following the string | ||
c constants indicates a C string | c constants indicates a C string | ||
WRITE(1, '(A)') 'Extra null char'! ! The | WRITE(1, '(A)') 'Extra null char'! ! The "!" treats this | ||
c string as a C string | c string as a C string | ||
CLOSE (1) | CLOSE (1) |
Latest revision as of 11:04, 20 July 2020
PSS ID Number: 109879
Article Last Modified on 11/2/1999
The information in this article applies to:
- Microsoft Fortran Powerstation 32 for Windows NT 1.0
This article was previously published under Q109879
SYMPTOMS
A program containing "!" (to denote an inline comment) directly following a string constant interprets the "!" as the letter "C" and appends a null character to the string.
STATUS
Microsoft has confirmed this to be a problem in Microsoft FORTRAN PowerStation 32 version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATION
String values in the C language are terminated with null characters. This type of string is specified in Microsoft FORTRAN by using a standard string constant followed by the character C. The code sample below shows how unwanted null characters are appended to string constants with "!" directly following.
Sample Code
OPEN (1, FILE='TEST') WRITE(1, '(A)') 'Normal string' ! This is a normal FORTRAN c string WRITE(1, '(A)') 'Normal C string'C ! The C following the string c constants indicates a C string WRITE(1, '(A)') 'Extra null char'! ! The "!" treats this c string as a C string CLOSE (1) END
Additional query words: 1.00
Keywords: KB109879
Technology: kbAudDeveloper kbFORTRANPower32100NT kbFortranSearch kbZNotKeyword2