what is # # in C

Go4Expert Member
27Apr2006,16:58   #1
priyapai's Avatar
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
Go4Expert Founder
27Apr2006,19:50   #2
shabbir's Avatar
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.
Contributor
28Apr2006,09:25   #3
sharmila's Avatar
## 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
Team Leader
28Apr2006,10:44   #4
coderzone's Avatar
I didn't knew about ## operator. Thanks for the info sharmila.
Contributor
28Apr2006,14:17   #5
sharmila's Avatar
Its my pleasure.
Go4Expert Member
28Apr2006,14:49   #6
priyapai's Avatar
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 :-)
Go4Expert Founder
28Apr2006,20:39   #7
shabbir's Avatar
Quote:
Originally Posted by coderzone
I didn't knew about ## operator. Thanks for the info sharmila.
Nor did I knew about it.
Contributor
9May2006,22:00   #8
Aztec's Avatar
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;
}
Go4Expert Member
10May2006,09:07   #9
priyapai's Avatar
thanx Aztec...

Its clear to me....

Thanx Forum members for responding to my query


regards
Priya