Line feed in VC, single slash "\"

Source: Internet
Author: User


Http://blog.sina.com.cn/s/blog_69ebf25c0100kl0c.html

What does single slash "\" in VC mean at the end of a row?  Reward score: 10 - Resolution time:
20: 11
 
What does single slash "\" in VC mean at the end of a row? For example: # define code_work \ index_check = toindex (check); \ If (next = target) return checkstep [index_check] + 1; \ index_next = toindex (next );\
Questioner: Wujianhao050 - Level 4 Best Answer
 there is a formal name for this stuff called a line break, add and remove the same values after the regular  Code  line (VC automatically judges the continued rows), but it is particularly useful in macro definition, because the macro definition must be completed in one line: # define somefun (X, a, B) if (x) x = a + B; else x = A-B; this line of definition is fine, but this code is not easy to understand and will be difficult to maintain in the future. If it is written as: # define somefun (X, a, B) if (X) X = a + B; else x = A-B; this is a good understanding, but the compiler will make an error because it will think that # define somefun (X, a, B) is a complete line. If (X) and the subsequent statements are irrelevant to # define somefun (X, a, B. in this case, we must use the following statement: # define somefun (X, a, B) \ If (x) \ x = a + B; \ else \ x = A-B; note: Do not add a line break to the last line. the pre-processor of VC automatically removes the \ and line feed carriage return before compilation, so that reading is not affected, but the logic is not affected. 

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.