C preprocessor
http://en.wikipedia.org/wiki/C_preprocessor
C preprocessor
from Wikipedia, the free encyclopedia
Jump to:navigation, search
The C preprocessor (cpp) is the preprocessor for the C programming language. In many C implementations, it is a separate program invoked by the compiler as the first part of translation. The preprocessor handles directives for source file inclusion (#include), macro definitions (#define), and conditional inclusion (#if). The language of preprocessor directives is agnostic to the grammar of C, so the C preprocessor can also be used independently to process other types of files.
The transformations it makes on its input form the first four of C's so-called Phases of Translation. Though an implementation may choose to perform some or all phases simultaneously, it must behave as if it performed them one-by-one in order.
Contents
[hide]
1 Phases
2 Including files
3 Conditional compilation
4 Macro definition and expansion
4.1 Standard predefined positioning macros
4.2 Precedence
4.3 Multiple lines
4.4 Multiple evaluation of side effects
4.5 Token concatenation
4.6 Semicolons
4.6.1 Multiple statements
4.7 Quoting macro arguments
4.7.1 Indirectly quoting macro arguments
4.8 Variadic macros
4.9 X-Macros
4.10 Compiler-specific predefined macros
5 User-defined compilation errors and warnings
6 Compiler-specific preprocessor features
7 As a general-purpose preprocessor
8 See also
9 References
10 External links
[edit] Phases
The following are the first four (of eight) phases of translation specified in the C Standard:
Trigraph Replacement - The preprocessor replaces trigraph sequences with the characters they represent.
Line Splicing - Physical source lines that are continued with escaped newline sequences are spliced to form logical lines.
Tokenization - The preprocessor breaks the result into preprocessing tokens and whitespace. It replaces comments with whitespace.
Macro Expansion and Directive
相关文档:
学东西,往往实例才是最让人感兴趣的,老是学基础理论,不动手,感觉没有成就感,呵呵。
下面先来一个实例。我们通过创建两个线程来实现对一个数的递加。
或许这个实例没有实际运用的价值,但是稍微改动一下,我们就可以用到其他地方去拉。
下面是我们的代码:
/*thread_example.c : c multiple thread p ......
1.首先看懂官方文档
2.icbc.jar这个jar包一定要要到!这是进行base64加密解密,以及
使用工行证书签名的重要工具类。
3.采取纯Java编码,要确保用对证书,放在D盘根目录下(其他路径亦可)。
4.编写JSP接口页面,字段必须与工行的一一对应。
而且如tranData等字段进行base64加密后或者签名后 必须以"“双引号扩上才 ......
要让 Eclipse 可以开发 C/C++ 程式,要挂上 CDT 才可以。
首先要下载CDT
CDT的最新版本是 3.1.0,它支持eclipse3.2.0,其下载地址:http://download3.eclipse.org/tools/cdt/releases/callisto/dist/3.1.0/,或者是到http://www.eclipse.org/cdt/downloads.php下载其它� ......
/*
* File: main.cpp
* Author: Vicky
*
* Created on 2010年5月8日, 下午2:47
*/
#include <iostream>
using namespace std;
class A{
public:
A(){
cout << "执行构造函数创建一个对象" << endl;
}
A(A&){
cout << "执行拷贝函数拷贝一个� ......
1、http://snippets.dzone.com/tag/c/ --数以千计的有用的C语言源代码片段
2、http://www.hotscripts.com/category/c-cpp/scripts-programs/ Hotscripts --提供数以百计的C和C++脚本和程序。所有程序都分为不同的类别。
3、http://www.planetsourcecode.com/vb/default.asp?lngWId=3 --超过万行C和C++免费的源代码
4� ......