user-0 提问: 关于c语言预处理的问题

回复:
user: user-1
content: 大小写要注意，双横线要注意，空格要注意，中英文符号要注意

user: user-2
content: 常识，宏和变量标识符一样的啊，不可能有分隔符空格的啊，这是菜鸟也要清楚的基础问题。

user: user-3
content: 关于自己是否适合编程的很简单的测试： 在报纸或杂志上随便找一段约1000字的文章，在Word中输入一遍。输完后再参考下面答案：  A里面有10处以上文字或标点错误 B里面没有文字或标点错误并敢为此跟人打赌 C里面没有文字或标点错误并且字体和排版完全与原稿一致 D打印在半透明的纸上和原稿重叠在一起检查一模一样，且自我感觉很有成就感  A不适合编程（理由：打字准确度偏低、粗心大意） B初级程序员（理由：打字准确度很高、认真细致、自信、理解全角半角概念） C高级程序员（理由：在B的基础上理解字体和排版也是电脑打印的重要因素、但相比D还不够偏执、精益求精、结果可验证） D软件项目经理（理由：能针对项目给出令人信服的细致到极点的需求说明和典型测试用例。用户几乎挑不出毛病。专业！）  如果想从A变成B的话，到我的资源http://download.csdn.net/detail/zhao4zhong1/4084259里面下载“适合程序员的键盘练习”

user: user-0
content: 补充：   这里是双下划线间无空格情况  这里是有空格的情况

user: user-0
content: 是     printf("%s:%d\n",_ _file_ _,_ _line_ _); 两个下划线间有空格隔开，还是没空格隔开?    如    printf("%s:%d\n",__file__,__line__);  不管怎么样，还是编译失败

user: user-4
content: 引用 7 楼 A1429892697 的回复:是     printf("%s:%d\n",_ _file_ _,_ _line_ _); 两个下划线间有空格隔开，还是没空格隔开?    如    printf("%s:%d\n",__file__,__line__);  不管怎么样，还是编译失败 从标准文档pdf复制下来的会自动加空格。原文是完整的标识符，没有空格隔开。

user: user-5
content: 看不懂我就来看看。。。。

user: user-3
content: __LINE__和__line__不是一回事！  Predefined Macros The compiler recognizes six predefined ANSI C macros (see Table 1.1), and the Microsoft C++ implementation provides several more (see Table 1.2). These macros take no arguments and cannot be redefined. Their value (except for __LINE__ and __FILE__) must be constant throughout compilation. Some of the predefined macros listed below are defined with multiple values. Their values can be set by selecting the corresponding menu option in the Visual C++ development environment, or by using a command-line switch. See the tables below for more information.  Table 1.1   ANSI Predefined Macros  Macro Description  __DATE__ The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H.   __FILE__ The name of the current source file. __FILE__ expands to a string surrounded by double quotation marks.   __LINE__ The line number in the current source file. The line number is a decimal integer constant. It can be altered with a #line directive.   __STDC__ Indicates full conformance with the ANSI C standard. Defined as the integer constant 1 only if the /Za compiler option is given and you are not compiling C++ code; otherwise is undefined.   __TIME__ The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.   __TIMESTAMP__ The date and time of the last modification of the current source file, expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, where Ddd is the abbreviated day of the week and Date is an integer from 1 to 31.       Table 1.2   Microsoft-Specific Predefined Macros   Macro Description  _CHAR_UNSIGNED Default char type is unsigned. Defined when /J is specified.   __cplusplus Defined for C++ programs only.  _CPPRTTI Defined for code compiled with /GR (Enable Run-Time Type Information).  _CPPUNWIND Defined for code compiled with /GX (Enable Exception Handling).  _DLL Defined when /MD or /MDd (Multithread DLL) is specified.  _M_ALPHA Defined for DEC ALPHA platforms. It is defined as 1 by the ALPHA compiler, and it is not defined if another compiler is used.  _M_IX86 Defined for x86 processors. See Table 1.3 for more details.  _M_MPPC Defined for Power Macintosh platforms. Default is 601 (/QP601). See Table 1.4 for more details.  _M_MRX000 Defined for MIPS platforms. Default is 4000 (/QMR4000). See Table 1.5 for more details.  _M_PPC Defined for PowerPC platforms. Default is 604 (/QP604). See Table 1.6 for more details.  _MFC_VER Defines the MFC version. Defined as 0x0421 for Microsoft Foundation Class Library 4.21. Always defined.  _MSC_EXTENSIONS This macro is defined when compiling with the /Ze compiler option (the default).  Its value, when defined, is 1.  _MSC_VER Defines the compiler version. Defined as 1200 for Microsoft Visual C++ 6.0. Always defined.  _MT Defined when /MD or /MDd (Multithreaded DLL) or /MT or /MTd (Multithreaded) is specified.   _WIN32 Defined for applications for Win32®. Always defined.     As shown in following tables, the compiler generates a value for the preprocessor identifiers that reflect the processor option specified.  Table 1.3   Values for _M_IX86  Option in Developer Studio Command-Line Option Resulting Value  Blend /GB _M_IX86 = 500 (Default. Future compilers will emit a different value to reflect the dominant processor.)  Pentium /G5 _M_IX86 = 500  Pentium Pro /G6 _M_IX86 = 600  80386 /G3 _M_IX86 = 300  80486 /G4 _M_IX86 = 400       Table 1.4   Values for _M_MPPC  Option in development environment Command-Line Option Resulting Value  PowerPC 601 /QP601 _M_MPPC = 601 (Default)  PowerPC 603 /QP603 _M_MPPC = 603  PowerPC 604 /QP604 _M_MPPC = 604  PowerPC 620 /QP620 _M_MPPC = 620       Table 1.5   Values for _M_MRX000  Option in Developer Studio Command-Line Option Resulting Value  R4000 /QMR4000 _M_MRX000 = 4000 (Default)  R4100 /QMR4100 _M_MRX000 = 4100  R4200 /QMR4200 _M_MRX000 = 4200  R4400 /QMR4400 _M_MRX000 = 4400  R4600 /QMR4600 _M_MRX000 = 4600  R10000 /QMR10000 _M_MRX000 = 10000       Table 1.6   Values for _M_PPC  Option in Developer Studio Command-Line Option Resulting Value  PowerPC 601 /QP601 _M_PPC = 601  PowerPC 603 /QP603 _M_PPC = 603  PowerPC 604 /QP604 _M_PPC = 604 (Default)  PowerPC 620 /QP620 _M_PPC = 620

user: user-6
content: 试一下这个： #include <stdio.h>  int main( int argc,char const *argv[] ) { 	printf("%s:%d\n",__FILE__,__LINE__); 	printf("%s,%s\n",__DATE__,__TIME__); 	return 0; }

user: user-7
content: 2楼说的对

user: user-8
content: 引用 3 楼 derekrose 的回复:上面说的对。。+1

user: user-9
content: 好像是 __FILE__ __LINE__ 两个下划线吧， 一个的未定义， 你看下是不是？

user: user-10
content: 上面说的对。。

user: user-11
content: _ _DATE_ _: 注意前后各两个下划线

user: user-11
content: c标准里定义的预定义宏 _ _DATE_ _ The date of translation of the preprocessing translation unit: a character string literal of the form "Mmm dd yyyy", where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10. If the date of translation is not available, an implementation-defined valid date shall be supplied. _ _FILE_ _ The presumed name of the current source file (a character string literal).152) _ _LINE_ _ The presumed line number (within the current source file) of the current source line (an integer constant).152) _ _STDC_ _ The integer constant 1, intended to indicate a conforming implementation. _ _STDC_HOSTED_ _ The integer constant 1 if the implementation is a hosted implementation or the integer constant 0 if it is not. _ _STDC_VERSION_ _ The integer constant 199901L.153) _ _TIME_ _ The time of translation of the preprocessing translation unit: a character string literal of the form "hh:mm:ss" as in the time generated by the asctime function. If the time of translation is not available, an implementation-defined valid time shall be supplied.  你说的_line_、_file_、_date_、_time_是某个编译器自定义的扩展，在其他编译器下就可能不支持