关于使用C99 __func__宏 [英] On use of C99 __func__ macro
问题描述
大家好,
做这两件事情是一回事吗?
#define WHERE printf(" We in in%s" ,__ func__)
void函数(无效){
WHERE;
}
这个:
void函数(无效){
#define WHERE printf("我们在%s",__ func__)
WHERE;
}
-
Guillaume Dargaud
http://www.gdargaud.net/
男人的手机是怎么回事?在一个剧院里,让他看起来越来越像Abe Lincoln? - Jerry L. Embry。
12月5日下午1:29,Guillaume Dargaud
< ; use_the_form_on_my_contact_p ... @ www.gdargaud.netw死记硬背:
大家好,
做这两件事情是一回事吗:
#define WHERE printf(我们在%s,__ func__)
void函数(无效){
在哪里;
}
这个:
void函数(void){
#define WHERE printf(我们在%s,__ func__)
WHERE;
}
C99中没有__func__。
vi ****** @ gmail.com schrieb:
12月5日下午1:29, Guillaume Dargaud
< use_the_form_on_my_contact_p ... @ www.gdargaud.netw rote:
> #define WHERE printf(" We in in%s",__ func__)
void Function(void){
WHERE;
}
这个:
void函数(void){
#define WHERE printf(" We are在%s",__ func__)
在哪里;
}
是的。两者都扩展为:
void函数(无效){
printf(我们在%s,__ func__);
}
C99中没有__func__。
有。
6.4.2.2#1说:
标识符__func__应由翻译者隐式声明
,就像紧接每个函数的开头大括号
定义一样,声明
static const char __func __ [] =" function-name";
出现了,其中function-name是词法封闭的名称
功能。
-
OMG,-10 = = 10 in linux!
在文章< fj ********** @ ccpntc8.in2p3.fr>,
Guillaume Dargaud< us ************** ***************@www.gdargaud.netw死记硬背:
>这两个做同样的事情事情:
#define WHERE printf(我们在%s,__ func__)
void函数(void){
WHERE;
}
这个:
void函数(void){
#define WHERE print f(我们在%s,__ func__)
WHERE;
}
是的,因为__func__是必需的变得像一个变量,而不是
a预处理宏。
- 理查德
-
应考虑在一些字母表中需要多达32个字符
- 1963年的X3.4。
Hello all,
Is it the same thing to do those two things:
#define WHERE printf("We are in %s", __func__)
void Function(void) {
WHERE;
}
And this:
void Function(void) {
#define WHERE printf("We are in %s", __func__)
WHERE;
}
--
Guillaume Dargaud
http://www.gdargaud.net/
"What is it about a man''s cell phone going off in a theater that makes him
look more and more like Abe Lincoln ? - Jerry L. Embry.
On Dec 5, 1:29 pm, "Guillaume Dargaud"
<use_the_form_on_my_contact_p...@www.gdargaud.netw rote:Hello all,
Is it the same thing to do those two things:
#define WHERE printf("We are in %s", __func__)
void Function(void) {
WHERE;
}
And this:
void Function(void) {
#define WHERE printf("We are in %s", __func__)
WHERE;
}There''s no __func__ in C99.
vi******@gmail.com schrieb:On Dec 5, 1:29 pm, "Guillaume Dargaud"
<use_the_form_on_my_contact_p...@www.gdargaud.netw rote:
>#define WHERE printf("We are in %s", __func__)
void Function(void) {
WHERE;
}
And this:
void Function(void) {
#define WHERE printf("We are in %s", __func__)
WHERE;
}
Yes. Both expands to:
void Function(void) {
printf("We are in %s", __func__);
}
There''s no __func__ in C99.There is.
6.4.2.2 #1 says:
The identifier __func__ shall be implicitly declared by the translator
as if, immediately following the opening brace of each function
definition, the declaration
static const char __func__[] = "function-name";
appeared, where function-name is the name of the lexically- enclosing
function.
--
OMG,-10==10 in linux!
In article <fj**********@ccpntc8.in2p3.fr>,
Guillaume Dargaud <us*****************************@www.gdargaud.netw rote:
>Is it the same thing to do those two things:
#define WHERE printf("We are in %s", __func__)
void Function(void) {
WHERE;
}
And this:
void Function(void) {
#define WHERE printf("We are in %s", __func__)
WHERE;
}Yes, because __func__ is required to be like a variable, rather than
a preprocessor macro.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
这篇关于关于使用C99 __func__宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!