C Programming language Note (14) Reference manual 6

Source: Internet
Author: User
Tags float double

Pretreatment
The preprocessor performs macro substitution conditional compilation and the command line (#前可以有空格) that contains the specified file starting with # is the preprocessor-processed object preprocessing process can be divided into several sequential stages 1. Converts a three-character sequence to an equivalent character. If the operating system requires it, also insert a line break between the lines of the source file 2. Remove the backslash \ Before the line break in the instruction line to connect the command lines 3. Divide the program into tokens separated by whitespace, and the comments will be replaced with a white space character. The preprocessing instructions are then executed, And make a macro replacement 4. Replace the sequence of escape characters in string constants and string literals with equivalent characters, and then concatenate adjacent string literals by 5. Collect the necessary programs and data, and connect the references to external functions and objects to their definitions, translate the results from the above processing, and then connect with other programs and libraries

  

12.1 Three-character sequence

  

12.2 Row Connection
By removing the backslash and subsequent newline characters at the end of the command line with a backslash \ End, you can merge several instruction lines into one line, which is done before the delimiter

  

12.3 Macro Definitions and extensions
A control directive that resembles the following form a # define identifier sequence will cause the preprocessor to replace each instance of the identifier with a given tick sequence with the specified sequence of whitespace before and after the white space character is discarded the second time a # define directive defines the same identifier is an error similar to the following form of identifier # The define identifier (identifier table) tick mark is a macro definition with parameters, where the first identifier and parentheses (no spaces between them) are the same as in the first form, and the whitespace characters before and after the tick sequence are discarded. If you want to redefine a macro, you must ensure that the number of its parameters is spelled and the sequence of tokens is the same as the previous definition #undef the preprocessor definition used to cancel the identifier applies #undef to the unknown identifier and does not cause the error to define the macro in the second form, in which case the identifier is surrounded by a pair of parentheses. A comma-delimited sequence of tokens makes up a macro call the actual argument of a macro invocation is a comma-delimited sequence of tokens enclosed in quotation marks or nested parentheses, the comma cannot be used for the actual argument in the process of processing, when the actual parameter does not make a macro expansion macro call, the number of actual arguments must match the number of formal parameters in the definition

  

12.4 file contains
#include < file name > replace the line with the file specified by file name # include "file name" searches the specified file from the location of the source file, and if no specified file is found, the first way to process the # include notation sequence # include Files can be nested

  

12.5-Piece compilation
If line: #if constant expression #ifdef identifier #ifndef identifier elif part: Elif line text elif section elif row #elif constant expression else part else line text Else line # Else

  

12.6-row control
To make it easier for other preprocessor to generate C language #line constant  ' file name ' #line constant will cause the compiler to think that the line number of the next line of source code is given as a decimal constant and that the current input file is named by that identifier.

  

12.7 error message Generation
#error sequence of tokens enables the preprocessor to print diagnostic information containing the sequence of tokens

  

12.8pragma
#pragma token sequence will cause the preprocessor to perform a specific implementation-related operation unrecognized pragma will be ignored

  

12.9 NULL Instruction
#形式的预处理器将不执行任何操作

  

12.10 Pre-defined names
Some identifiers are pre-defined, and will generate specific information after they are extended they are the same as the preprocessor expression operator defined, and cannot be undefined or redefined __line__  contains the current source file function __file__   A string containing the source file being compiled __ date__  Compile date "Mmm dd yyyy" __time__  compile Time "hh:mm:ss" __stdc__  integer constant 1

13 syntax
Storage Class Descriptor: One ofauto register static extern typedef type specifier: one ofvoid char short int long float double signed unsigned type qualifier: one OFCONST volatile structure or union: one ofstruct Union enum specifier: enum constant: integer constant character constant floating point constant enumeration constant control directive: #define Identifier Tick sequence # define identifier (identifier table) tick sequence # undef identifier # include < filename > #include "file name" #include tick sequence #line constant "file name" #line constant #error tick sequence #pragma tick sequence

  

C Programming language Note (14) Reference manual 6

Related Article

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.