what is # # in C

priyapai's Avatar, Join Date: Mar 2006
Go4Expert Member
Hi all,

today i was going thru a code, wer i found this macro definition,


#define _L(a) (TPtrC((const TText *)L ## a))

where TPtrC and TText r user defined data-types,

wat is the ## symbol for.....



-priya
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Can you let us have the complete context where you found this.

Offtopic comment:
Also try creating the thread in the correct section and only one. I have closed the other thread as duplicate and moved them to the correct section as well.
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
## is a concatination preprocessor operator.
#define _L(a) (TPtrC((const TText *)L ## a)) means
here the value of 'a' is appended to (const TText *)L and the whole thing is passed to TPtrC function.

For more clarification you can go through the link
http://developer.apple.com/documenta...#Concatenation
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
I didn't knew about ## operator. Thanks for the info sharmila.
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
Its my pleasure.
0
priyapai's Avatar, Join Date: Mar 2006
Go4Expert Member
i was asked by my senior to review a piece of code, and the statement was part of it....

it is clear to me now.

Thanx :-)
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by coderzone
I didn't knew about ## operator. Thanks for the info sharmila.
Nor did I knew about it.
0
Aztec's Avatar, Join Date: May 2006
Contributor
Sample code to make things more clear:-

Code:
#include<stdio.h>
#define JOIN(a, b) a ## b
int main()
{

printf("%s",JOIN("Hi","Everyone"));

return 0;
}
0
priyapai's Avatar, Join Date: Mar 2006
Go4Expert Member
thanx Aztec...

Its clear to me....

Thanx Forum members for responding to my query


regards
Priya