Fatal error c1071: unexpected end of file found in comment (Mark zz)

Source: Internet
Author: User

I saw a one-person post on a forum today:

「 There was a strange problem recently,CodeThe Chinese annotations in enableProgramError !!!
Refer to the following code:
Int main (){
Int A = 0;
Int B = 0;

/** Parking source word */------ should be changed to "/* (space, or not empty) * parking source word (Space )*/"
A = 10;
B = 20;

/** End of comment */------ should be changed to "/* (space, or not empty) * end of comment (Space )*/"
Printf ("A = % d \ TB = % d", a, B );

Return 0;
}
The running result is: a = 0 B = 0
After analysis, it is found that the Intermediate Value assignment statement is treated as a comment and ignored.
Do you have this problem? How to explain it? How can this problem be avoided?
The compiling environment is VC ++ 6.0 .』

In fact, what I encountered was not fatal error c1071: unexpected end of file found in comment,

Check: When the comment contains Chinese characters, add a space at the end of the single line comment, and add a space before the multi-line comment...
Of course, it is best to use English for comments.

Because some special Chinese characters are processed into special escape sequences in some character sets, and the ending character in the GBK character set also contains the c Standard Escape Character 0x5c '\\', in these cases, an error occurs when the escape character is followed by */or a line comment, especially when compiling in a non-Chinese system. Modify as above.

 

The running result is: a = 0 B = 0 ------ the possible space is
/** Parking source word */
A = 10;
B = 20;

/** End comment (Space) */------ there is space here,/** stop ..... Do not run between bundles (spaces.
Printf ("A = % d \ TB = % d", a, B );

If it is/**/, no such problems will occur.

Http://topic.csdn.net/u/20100325/22/46c67761-38c8-4505-90bd-7c118791a298.html

Http://topic.csdn.net/u/20070627/21/82ab7370-5a98-4e4d-8ed4-da6ad0996b84.html? 310753027

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.