TAILIEUCHUNG - Appendix A The Preprocessor

The preprocessor is that part of the compiler that performs various text manipulations on your program prior to the actual translation of your source code into object code. You can give text manipulation commands to the preprocessor. These commands are called preprocessor directives, and although not technically part of the C++ language, they expand the scope of its programming environment. The preprocessor is a holdover from C and is not as important to C++ as it is to C. Also, some preprocessor features have been rendered redundant by newer and better C++ language elements. However, since many programmers. | Appendix A The Preprocessor The preprocessor is that part of the compiler that performs various text manipulations on your program prior to the actual translation of your source code into object code. You can give text manipulation commands to the preprocessor. These commands are called preprocessor directives and although not technically part of the C language they expand the scope of its programming environment. The preprocessor is a holdover from C and is not as important to C as it is to C. Also some preprocessor features have been rendered redundant by newer and better C language elements. However since many programmers still use the preprocessor and because it is still part of the C language environment it is briefly discussed here. The C preprocessor contains the following directives define if endif undef error else ifdef Hne include elif ifndef pragma As is apparent all preprocessor directives begin with a sign. Each will be examined here in turn. define define is used to define an identifier and a character sequence that will be substituted for the identifier each time it is encountered in the source file. The identifier is called a macro name and the replacement process is called macro substitution. The general form of the directive is define macro-name character-sequence Notice that there is no semicolon in this statement. There can be any number of spaces between the identifier and the start of the character sequence but once the sequence begins it is terminated only by a newline. For example if you wanted to use the word UP for the value 1 and the word DOWN for the value 0 you would declare these two defines define UP 1 define DOWN 0 These statements will cause the compiler to substitute a 1 or a 0 each time the name UP or DOWN is encountered in your source file. For example the following will print 102 on the screen 1 C A Beginner s Guide by Herbert Schildt It is important to understand that the macro substitution is simply the replacing of an .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.