Querry Regarding Define

P

Priya Mishra

Hi All,

#define _LIT16(name,s) static const TLitC16<sizeof(L##s)/2>
name={sizeof(L##s)/2-1,L##s}
#define _L(a) (TPtrC((const TText *)L ## a))

can any one explain me the above two, I am geting bit confused.

Thanks In Advance.
Priya
 
?

=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=

Priya Mishra said:
#define _LIT16(name,s) static const TLitC16<sizeof(L##s)/2>
name={sizeof(L##s)/2-1,L##s}
#define _L(a) (TPtrC((const TText *)L ## a))

This looks like C++, not C.

DES
 
P

Pieter Droogendijk

Hi All,

#define _LIT16(name,s) static const TLitC16<sizeof(L##s)/2>
name={sizeof(L##s)/2-1,L##s}

It's generally a good idea to keep your lines shorter than 80 characters.
Especially when posting to usenet. This would be a syntax error, but I'll
imagine there's a backslash at the end of the first line.

Also, _LIT16 is also a bad thing to call virtually anything, since you'd
be invading implementation namespace. The same goes for _L.
#define _L(a) (TPtrC((const TText *)L ## a))

I couldn't tell you what they're for, but:

_LIT16 (poop, string)
Should expand to the following:
static const TLitC16<sizeof(Lstring)/2> \
poop={sizeof(Lstring)/2-1,Lstring}

Which looks like a C++ template function of some sort. See comp.lang.c++
for more information about this.

_L (voov);
Should expand to:
(TPtrC((const TText *)Lvoov));

Which looks like a screaming mad sort of wrapper thing. Or a macro to
build screaming mad sort of wrapper things. Or possibly an uran-utan.



Google tells me both macros are part of the Symbian Developer Library,
which is indeed a C++ API, and that both macros were in fact /NOT/
written by someone called Bergholt Stuttley Johnson.

http://www.symbian.com/developer/te...erence/cpp/LiteralDescriptors/Lit16Macro.html
http://www.symbian.com/developer/te...ference/cpp/LiteralDescriptors/LMacro.html#_L
can any one explain me the above two, I am geting bit confused.

No wonder.
 
K

Kleuskes & Moos

Hi All,

#define _LIT16(name,s) static const TLitC16<sizeof(L##s)/2>
name={sizeof(L##s)/2-1,L##s}

This appears to be intended for a C++ program. It defines a
constant instance of the TLitC16 template passing the size of some
family of types or variables 'Lx' where x is an integer. Given the usage
of 'name', i suspect a backslash is ommitted.
#define _L(a) (TPtrC((const TText *)L ## a))

This seems to define 'L' referenced above. A nice piece of obfuscated
coding.
can any one explain me the above two, I am geting bit confused.

Obviously. This refers to a C++ program using templates. It isn't C.
Thanks In Advance.

My pleasure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top