TEXT vs. _T - Programmer

This is a discussion on TEXT vs. _T - Programmer ; Which is the better of the two macros to use in general Windows programming, TEXT or _T (include tchar.h)? Why might I use one over the other? -- Ken Wilson Seeking viable IT employment in Victoria, BC Feel free to ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: TEXT vs. _T

  1. TEXT vs. _T

    Which is the better of the two macros to use in general Windows
    programming, TEXT or _T (include tchar.h)? Why might I use one over
    the other?

    --
    Ken Wilson
    Seeking viable IT employment in Victoria, BC
    Feel free to contact me if you have any leads.

  2. Re: TEXT vs. _T

    On Thu, 05 Oct 2006 07:17:30 GMT, Ken Wilson
    wrote:

    >Which is the better of the two macros to use in general Windows
    >programming, TEXT or _T (include tchar.h)? Why might I use one over
    >the other?


    They are both defined in tchar.h. One is defined to be the other. So
    neither is really better than the other, and the only difference is
    programming style.

    Although tchar.h is not meant for human reading (I sure needed several
    tries), I rather strongly recommend reading it; it clarifies many
    things like this. Also, if you enable browsing
    (Project->Settings->C/C++->General->Generate Browse Info _and_
    Project->Settings->Browse Info), you can right click on a name and
    then choose "Show definition" to see its actual definition.


    -----------------------------------------
    To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

    Robert E. Zaret, eMVP
    PenFact, Inc.
    20 Park Plaza, Suite 478
    Boston, MA 02116
    www.penfact.com

  3. Re: TEXT vs. _T

    On Thu, 05 Oct 2006 15:56:11 -0500, r_z_aret@pen_fact.com wrote:

    >On Thu, 05 Oct 2006 07:17:30 GMT, Ken Wilson
    > wrote:
    >
    >>Which is the better of the two macros to use in general Windows
    >>programming, TEXT or _T (include tchar.h)? Why might I use one over
    >>the other?

    >
    >They are both defined in tchar.h. One is defined to be the other. So
    >neither is really better than the other, and the only difference is
    >programming style.


    I checked tchar.h and it defines _TEXT(x), not TEXT(x). The only
    place I was able to find TEXT(x) defined was in WinNT.h I am thinking
    that, unless I specifically need to include tchar.h when windows.h is
    already included, I will satisfy myself with just using the TEXT(x)
    macro for simplicity.

    >
    >Although tchar.h is not meant for human reading (I sure needed several
    >tries), I rather strongly recommend reading it; it clarifies many
    >things like this. Also, if you enable browsing
    >(Project->Settings->C/C++->General->Generate Browse Info _and_
    >Project->Settings->Browse Info), you can right click on a name and
    >then choose "Show definition" to see its actual definition.


    Thanks for you advise on turning on browse info. I have to admit I
    have been ignoring it in favour of using f1 to invoke the MSDN library
    and looking at the MS documentation for methods. For investigating
    macros and defines, however, enabling browsing may be the best way to
    go.

    --
    Ken Wilson
    Seeking viable IT employment in Victoria, BC
    Feel free to contact me if you have any leads.

+ Reply to Thread