C ++项目类型:Unicode与多字节;利弊 [英] C++ project type: unicode vs multi-byte; pros and cons

查看:290
本文介绍了C ++项目类型:Unicode与多字节;利弊的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道Stack Overflow社区在创建具有unicode或多字节字符集的项目(这里主要考虑c ++)时会怎么想.

I'm wondering what the Stack Overflow community thinks when it comes to creating a project (thinking primarily c++ here) with a unicode or a multi-byte character set.

  • 使用Unicode有优势吗? 从一开始就直接暗示所有 您的字符串将采用宽格式? 是否存在性能问题/更大 内存需求,因为 标准使用更大的字符?

  • Are there pros to going Unicode straight from the start, implying all your strings will be in wide format? Are there performance issues / larger memory requirements because of a standard use of a larger character?

此方法是否有优势? 做一些处理器架构 更好地处理宽字符?

Is there an advantage to this method? Do some processor architectures handle wide characters better?

是否有任何理由使您的 如果您不打算使用项目Unicode 支持其他语言?

Are there any reasons to make your project Unicode if you don't plan on supporting additional languages?

创建具有多字节字符集的项目会有什么原因?

What reasons would one have for creating a project with a multi-byte character set?

上述所有因素如何在高性能环境(例如现代视频游戏)中发生冲突?

How do all of the factors above collide in a high performance environment (such as a modern video game) ?

推荐答案

我要评论的两个问题.

首先,您没有提及您要定位的平台.尽管最近的Windows版本(Win2000,WinXP,Vista和Win7)都支持使用字符串的多字节和Unicode版本的系统调用,但Unicode版本的速度更快(多字节版本是包装器,它们可以转换为Unicode,调用Unicode版本,然后转换返回的任何内容)字符串返回到mutlibyte).因此,如果您要进行许多此类呼叫,则Unicode会更快.

First, you don't mention what platform you're targeting. Although recent Windows versions (Win2000, WinXP, Vista and Win7) support both Multibyte and Unicode versions of system calls using strings, the Unicode versions are faster (the multibyte versions are wrappers that convert to Unicode, call the Unicode version, then convert any returned strings back to mutlibyte). So if you're making a lot of these types of calls the Unicode will be faster.

由于您不打算明确支持其他语言,因此如果您的应用程序保存并显示用户输入的文本,则仍应考虑支持Unicode.仅仅因为您的应用程序是非语言的,并不意味着它的所有用户也都是非语言的.他们可能会很乐意使用您的英语GUI,但可能希望以自己的语言输入名称,评论或其他文本,并正确显示它们.

Just because you're not planning on explicitly supporting additional languages, you should still consider supporting Unicode if your application saves and displays text entered by the users. Just because your application is unilingual, it doesn't follow that all it's users will be unilingual too. They may be perfectly happy to use your English language GUI, but might want to enter names, comments or other text in their own language and have them displayed properly.

这篇关于C ++项目类型:Unicode与多字节;利弊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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