启动新的Windows应用程序:我应该使用_TCHAR还是wchar_t文本? [英] Starting a new Windows app: Should I use _TCHAR or wchar_t for text?

查看:181
本文介绍了启动新的Windows应用程序:我应该使用_TCHAR还是wchar_t文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c ++中为Windows编写了一个新的个人爱好应用程序。

I'm coding up a new (personal hobby) app for Windows in c++.

在以前的低级Windows程序中,我使用了<$ c $

In previous low-level Windows stuff I've used _TCHAR (or just TCHAR) arrays/basic_strings for string manipulation.

使用 _TCHAR有任何优势如果我不在乎Win2k之前的Windows平台?

Is there any advantage to using _TCHAR over straight up Unicode with wchar_t, if I don't care about Windows platforms pre Win2k?


编辑:提交后我在2008年10月发现了一个类似的问题:

edit: after submitting I discovered a similar question here from Oct 2008:

http://stackoverflow.com/questions/234365/is-tchar -still-relevant

现在关于切断TCHAR的更多共识

Seems to be more consensus now about ditching TCHAR

推荐答案

没有没有。只是用wchar_t。

No there is not. Just go with wchar_t.

TCHAR仅在您希望能够使用条件编译开关将程序转换为以ASCII模式运行时才有用。由于Win2K和up是unicode平台,这个开关不提供任何值。你可能会暗示你的项目中的其他开发人员,ASCII是一个有效的目标,而事实上它不是。

TCHAR is only useful if you want to be able to use a conditional compilation switch to convert your program to operate in ASCII mode. Since Win2K and up are unicode platforms this switch does not provide any value. You'd instead be implying to other developers in your project that ASCII was a valid target when in fact it's not.

这篇关于启动新的Windows应用程序:我应该使用_TCHAR还是wchar_t文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆