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. 10 7838
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. vi******@gmail.com wrote:
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.
C & V please.
On Dec 5, 8:43 am, santosh <santosh....@gmail.comwrote:
vipps...@gmail.com wrote:
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.
C & V please.- Hide quoted text -
Why it's right here: http://www.youtube.com/watch?v=6lj9_zBobJs
On Dec 5, 3:43 pm, santosh <santosh....@gmail.comwrote:
vipps...@gmail.com wrote:
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.
C & V please.
I answered from memory.
Can't always be right on usenet :-)
Richard Tobin wrote:
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.
Not "because": even if it were a macro the answer would still be yes.
Neil.
In article <47*********************@news2.asahi-net.or.jp>,
Neil Booth <dev@nullwrote:
>>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.
>Not "because": even if it were a macro the answer would still be yes.
Um yes. I should have said "... rather than some magic thing that
gets replaced when it is first encountered in the text".
-- Richard
--
:wq
>>Not "because": even if it were a macro the answer would still be yes.
Um yes. I should have said "... rather than some magic thing that
gets replaced when it is first encountered in the text".
Thanks, that sums it up nicely.
--
Guillaume Dargaud http://www.gdargaud.net/ vi******@gmail.com wrote:
>
There's no __func__ in C99.
Just for the record, there is a __func__ in C99, ref. 6.4.2.2.
--
Tor <bw****@wvtqvm.vw | tr i-za-h a-z> This discussion thread is closed Replies have been disabled for this discussion. Similar topics
3 posts
views
Thread by chasdev |
last post: by
|
20 posts
views
Thread by Jim Ford |
last post: by
|
19 posts
views
Thread by Mockey Chen |
last post: by
|
9 posts
views
Thread by dave_140390 |
last post: by
|
1 post
views
Thread by somenath |
last post: by
|
33 posts
views
Thread by Peng Yu |
last post: by
| | | | | | | | | | |