C # preprocessing commands

Source: Internet
Author: User

1. First, we will introduce the most commonly used: # region and # endregion. This command is used to mark a piece of code as a block with a given name. As follows:

# Region helloint I = 1; string STR = "hello"; # endregion

2. # define and # UNDEF. (It must start with the C # source file)

# Define hello

It tells the compiler that there is a given name symbol, similar to declaring a variable, but there is no real value, just exist.

# UNDEF hello

Opposite to # define, This is a definition for deleting symbols. It seems that the system already exists (# define Debug) by default. If it is not used, # UNDEF debug. # define itself does not make sense. It must be used with other pre-processing commands (especially # If) to display powerful functions.

3. # If, # Elif, # else, endif. This attachment is one.

4. # warning and # error

When the compiler encounters this preprocessing instruction, it will generate a warning or error.

# If debug # warning "wwarning" // warning # error "error" // Error # endif

5. There are # Line and # pragma.

 

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.