Re: Are _T() and TEXT() macros equivalent?
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Mon, 16 Apr 2007 14:53:55 -0500
On Mon, 16 Apr 2007 10:15:58 -0700, "Tom Serface"
<tom.nospam@xxxxxxxxxxxxx> wrote:
It will mean that the variable holds a character (whatever that is depending
on the compile guidelines).
But we can already achieve that with TCHAR. Is it really so bad? I think it
would be bad for the meaning of a built-in type to be context-dependent in
this way. For example, consider a function like GetProcAddress. It's
defined in terms of LPCSTR, which indicates that even in Unicode builds,
it's still ANSI. With the meaning of char dependent on the capriciousness
of a switch, you couldn't use char in this way, even though the function
takes a string. I guess you'd use the new type 'byte", but that doesn't
convey the idea of "string" very well. Or maybe you'd invent a set of
macros akin to the current TCHAR family just so you can use char as you
once did. And if you did implement the /unicode switch, you'd have to cater
to the Unix crowd, and some of their compilers implement wchar_t as UCS-4.
So now you'd have sizeof(char) == 4, which is almost certainly >
sizeof(short), which violates another fundamental C and C++ rule, that
sizeof(char) <= sizeof(short). I guarantee you that the more an expert
thinks about this proposed change, the more problems and ripple effects he
will find, and this will go on for quite a while. It ain't a simple thing
to do.
--
Doug Harrison
Visual C++ MVP
.
- Follow-Ups:
- 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: Mihai N.
- Re: Are _T() and TEXT() macros equivalent?
- From: David Ching
- 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: Doug Harrison [MVP]
- Re: Are _T() and TEXT() macros equivalent?
- From: Doug Harrison [MVP]
- Re: Are _T() and TEXT() macros equivalent?
- From: Tom Serface
- Re: Are _T() and TEXT() macros equivalent?
- Prev by Date: Re: pointer to global var different in baseclass?
- Next by Date: Re: ODBC
- Previous by thread: Re: Are _T() and TEXT() macros equivalent?
- Next by thread: Re: Are _T() and TEXT() macros equivalent?
- Index(es):
Relevant Pages
|
Loading