Re: Are _T() and TEXT() macros equivalent?
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Sat, 14 Apr 2007 07:39:05 -0500
David Ching wrote:
Deplorable = the user was too lazy to type in the _T() around the string :o)
Absolutely amazing to me that some of the most practical and useful things are considered deplorable by others.
Joking apart, I would say that the vast majority of the uses of the automatic conversion from narrow to wide string are with hard coded strings where the programmer simply forgot to use _T("").
True story: In my copy of VC6, I modified the CString headers to remove the conversion constructors and assignments. This allowed me to catch many errors in my hybrid UTF8/UTF16 application. Some time later, I tried to make a Unicode build of Ultimate ToolBox and Ultimate Grid. Dozens of errors, all but one of which involved failure to use _T(""). The _T("") idiom was used correctly in other places.
Is this automatic conversion useful? I really don't think so. It just leads to a situation where it is possible to omit _T() (or L) in some places but not others. Soon the ANSI code page will be gone, and hybrid UTF16/UTF8 applications may become more common, and the automatic conversion will do the wrong thing (AFAIK, it is not possible to set the code page to be UTF8).
--
David Wilkinson
Visual C++ MVP
.
- Follow-Ups:
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Tom Serface
- Re: Are _T() and TEXT() macros equivalent?
- References:
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Mihai N.
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Mihai N.
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Joseph M . Newcomer
- Re: Are _T() and TEXT() macros equivalent?
- From: Doug Harrison [MVP]
- Re: Are _T() and TEXT() macros equivalent?
- From: Joseph M . Newcomer
- Re: Are _T() and TEXT() macros equivalent?
- From: Doug Harrison [MVP]
- Re: Are _T() and TEXT() macros equivalent?
- From: Joseph M . Newcomer
- Re: Are _T() and TEXT() macros equivalent?
- From: Doug Harrison [MVP]
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Mihai N.
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Tom Serface
- Re: Are _T() and TEXT() macros equivalent?
- From: David Wilkinson
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- From: Tom Serface
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- Re: Are _T() and TEXT() macros equivalent?
- Prev by Date: Re: Are _T() and TEXT() macros equivalent?
- Next by Date: Re: Are _T() and TEXT() macros equivalent?
- Previous by thread: Re: Are _T() and TEXT() macros equivalent?
- Next by thread: Re: Are _T() and TEXT() macros equivalent?
- Index(es):
Relevant Pages
|