Re: use ostream to output TCHAR

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
.



Relevant Pages

  • Re: Wit-to-whine ratios
    ... you are on record as saying that you acquired rights to the lcc compiler ... You force people like Navia to respond and then you drag them in the ... do nothing except destroy, in the dock of Old Bailey or in an American ... People like Heathfield have done the dirty work of this ...
    (comp.lang.c)
  • Five Reasons Political Correctness Must Die
    ... Five Reasons Political Correctness Must Die ... proceeded to try to destroy her life. ...
    (alt.politics.bush)
  • Re: Lunar Express
    ... Under the reasons that were taught to us at school, ... while the U.S.A. government can't buy any Russian ... National prestige is important, even if they are just paying the ride. ... Of course, to destroy something, something need to ...
    (sci.space.policy)
  • Re: Building a custom blocking dialog
    ... for reasons I can't explain quickly, ... So you need to write a custom modal dialog handler. ... DestroyWindow() to destroy the dialog ... EnableWindow() to enable the parent window ...
    (microsoft.public.win32.programmer.ui)
  • Re: Who struggles for civilization?
    ... struggles to survive. ... explained his reasons, most people failed to open their mind to understand ... Nazism and Japanese imperialism instead of giving their all to destroy ... were cancers, and as cancers they needed to be destroyed. ...
    (soc.culture.laos)