8051中如何使用__func__
How to use __func__ in 8051
我正在尝试在 8051 项目中使用 __func__
宏打印函数名称。
但是当我在Keil上构建时,它有这样的错误:
main.c(50): error C202: '__func__': undefined identifier
有没有类似的宏?
请帮我解决一下。
正如documentation所说,Keil C51编译器不支持这个宏,而且显然没有其他类似功能:
The Cx51 Compiler provides the following predefined constants you may use in preprocessor directives and C code to create portable programs.
Constant
Description
__C51__
Version number of the compiler (for example, 701 for version 7.01).
__CX51__
Version number of the compiler (for example, 701 for version 7.01).
__DATE__
Date when the compilation was started in ANSI format (month dd yyyy).
__DATE2__
Date when the compilation was started in short form (mm/dd/yy).
__FILE__
Name of the file being compiled.
__LINE__
Current line number in the file being compiled.
__MODEL__
Memory model selected:
0 for SMALL,
1 for COMPACT,
2 for LARGE.
__TIME__
Time when the compilation was started. (Format: hh:mm:ss)
__STDC__
Defined to 1 to indicate full conformance with the ANSI C Standard.
我正在尝试在 8051 项目中使用 __func__
宏打印函数名称。
但是当我在Keil上构建时,它有这样的错误:
main.c(50): error C202: '__func__': undefined identifier
有没有类似的宏? 请帮我解决一下。
正如documentation所说,Keil C51编译器不支持这个宏,而且显然没有其他类似功能:
The Cx51 Compiler provides the following predefined constants you may use in preprocessor directives and C code to create portable programs.
Constant Description __C51__
Version number of the compiler (for example, 701 for version 7.01). __CX51__
Version number of the compiler (for example, 701 for version 7.01). __DATE__
Date when the compilation was started in ANSI format (month dd yyyy). __DATE2__
Date when the compilation was started in short form (mm/dd/yy). __FILE__
Name of the file being compiled. __LINE__
Current line number in the file being compiled. __MODEL__
Memory model selected:
0 for SMALL,
1 for COMPACT,
2 for LARGE.__TIME__
Time when the compilation was started. (Format: hh:mm:ss) __STDC__
Defined to 1 to indicate full conformance with the ANSI C Standard.