Querry Regarding Define

Discussion in 'C Programming' started by Priya Mishra, Dec 14, 2005.

  1. Priya Mishra

    Priya Mishra Guest

    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
    Priya Mishra, Dec 14, 2005
    #1
    1. Advertising

  2. "Priya Mishra" <> writes:
    > #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
    --
    Dag-Erling Smørgrav -
    =?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=, Dec 14, 2005
    #2
    1. Advertising

  3. On Wed, 14 Dec 2005 03:55:01 -0800, Priya Mishra wrote:

    > 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.

    --
    Pieter Droogendijk <pieter at binky dot org dot uk>
    PGP/1E92DBBC [ Make way for the Emperor's Finest. ] binky.org.uk
    Pieter Droogendijk, Dec 14, 2005
    #3
  4. On Wed, 14 Dec 2005 03:55:01 -0800, Priya Mishra wrote:

    > 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.
    Kleuskes & Moos, Dec 14, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Graham

    feedback form querry

    Graham, Feb 12, 2004, in forum: HTML
    Replies:
    1
    Views:
    419
    Leif K-Brooks
    Feb 12, 2004
  2. SpaceGirl

    Parse querry string with ssi

    SpaceGirl, May 22, 2004, in forum: HTML
    Replies:
    2
    Views:
    1,158
    Martin Johansen
    May 23, 2004
  3. Maulik Thaker

    querry on ID's and IDREF in DTD

    Maulik Thaker, Feb 21, 2006, in forum: XML
    Replies:
    10
    Views:
    1,219
    Aalap
    Feb 25, 2006
  4. Lalatendu Das

    querry regarding function pointer

    Lalatendu Das, Mar 16, 2006, in forum: C Programming
    Replies:
    7
    Views:
    246
    Vladimir S. Oka
    Mar 16, 2006
  5. mohan

    querry regarding program to open a player

    mohan, Jan 4, 2007, in forum: C Programming
    Replies:
    7
    Views:
    269
    Richard Heathfield
    Jan 5, 2007
Loading...

Share This Page