Visual C++ 10 小写 __FILE__ 宏 [英] Visual C++ 10 lowercases the __FILE__ macro

查看:32
本文介绍了Visual C++ 10 小写 __FILE__ 宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual C++ 10 中的 __FILE__ 预处理器宏扩展为源模块的名称,但使用小写,例如

The __FILE__ preprocessor macro in Visual C++ 10 expands to the name of the source module, but in lowercase, e.g.

c:\path\to\my\file\somesource.cpp

当文件名实际上是

SomeSource.cpp

是否可以改变这种行为?

Is it possible to change this behaviour?

推荐答案

根据 Hans Passant 的建议,我 询问Microsoft Connect 并得到以下答案:

As suggested by Hans Passant, I asked the question on Microsoft Connect and got the following answer:

感谢您注意到这一点.这种行为已经存在一段时间了,至少可以追溯到 VS 2008.更改默认行为可能会对其他客户造成重大变化,所以我们更愿意保持当前的行为.由于 FOO.TXT 与文件系统的 foo.txt 大致相同,希望使用 __FILE__ 进行任何比较都可以涉及对您的应用程序不区分大小写的比较.

Thanks for noting this. This behavior has existed for a while, at least back to VS 2008. Changing the default behavior could potentially be a breaking change for other customers, so we would prefer to keep the current behavior. Since FOO.TXT is mostly the same as foo.txt for the file system, hopefully using __FILE__ with any comparison can just involve a case-insensitive compare for your application.

这篇关于Visual C++ 10 小写 __FILE__ 宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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