Re: use ostream to output TCHAR
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Sun, 04 Feb 2007 13:30:24 -0500
Joseph M. Newcomer wrote:
We should at least have a compiler option that says "treat all literal strings as const
data type". But that seems too much like something that makes sense, and why do that when
there are opportunities to destroy the IDE, destroy the incremental edit-and-go, destroy
the ability to see TRACE output after edit-and-go, and so on? Making const data types
work consistently might actually result in correct and reliable programs, and we can't
have that, now...
I dislike the Visual Studio IDE as much as anyone, but I don't think this assigning string literals to TCHAR* thing is Microsoft's fault. It is the fault of the C++ committee, for allowing it (for backward C compatiblity reasons).
<aside>
This string literal thing does not bother me because I never do it, and I never did do it. Reason: when I learned C long ago (and not very thoroughly; I was still into Fortran then) I somehow didn't pick up on the fact that you could do
char* p = "ABC";
and I would always do
char p[] = "ABC";
When I first saw the former some time later, it just seemed wrong to me, so I still didn't do it. Indeed, without the const introduced with C++ it may not be wrong, but it is certainly very dangerous, as we all know.
</aside>
IMHO, the default state of the compiler should be to implement the standard. Extensions and exceptions should have flags that have to be set. In this respect recent versions of the compiler have been much better.
David Wilkinson
.
- Follow-Ups:
- Re: use ostream to output TCHAR
- From: Joseph M . Newcomer
- Re: use ostream to output TCHAR
- References:
- use ostream to output TCHAR
- From: hyperandey
- Re: use ostream to output TCHAR
- From: David Wilkinson
- Re: use ostream to output TCHAR
- From: Joseph M . Newcomer
- Re: use ostream to output TCHAR
- From: David Wilkinson
- Re: use ostream to output TCHAR
- From: Joseph M . Newcomer
- Re: use ostream to output TCHAR
- From: David Wilkinson
- Re: use ostream to output TCHAR
- From: Joseph M . Newcomer
- use ostream to output TCHAR
- Prev by Date: Re: Batch file and MFC (Properly Terminating Application)
- Next by Date: Re: MFC, Threads, PostMessage, and Reentrant WindowProc
- Previous by thread: Re: use ostream to output TCHAR
- Next by thread: Re: use ostream to output TCHAR
- Index(es):
Relevant Pages
|