是新的C ++向后兼容 [英] Is new C++ backward compatible

查看:146
本文介绍了是新的C ++向后兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有在C ++中编码多年。我最近发现,在那些年里,它已经发生了巨大的变化。我不确定我喜欢的变化,但这是另一个讨论。



我仍然有一些C ++代码敲我的硬盘驱动器。如果我得到它,并试图用一个好的新的C ++编译器编译,说最新版本的g ++,它会编译?没有警告(假设它以前编译时没有警告)?



我最近遇到了一些VC ++ 2010,发现一些我期望工作的东西不工作,并得到不同的消息,取决于上下文,当我试图使用NULL。但在该代码的一部分,我使用NULL,甚至没有警告。

解决方案

一般来说,是向后兼容。但是,魔鬼在细节。你可能会发现惯例变化的东西,或者特定的库落入或不使用。


I haven't coded in C++ for years. I recently discovered that during those years it has changed quite dramatically. I'm not sure I like the changes, but that's another discussion.

I still have some C++ code knocking around my hard drive. If I got it out and tried to compile it with a nice new C++ compiler, say the latest version of g++, would it compile? Without warnings (assuming it compiled without warnings before)?

I did get to mess around with a little VC++ 2010 recently and found some things I expected to work just not working, and got different messages depending on context when I tried to use NULL. But in one part of that code I used NULL without even a warning.

解决方案

In general, yes it is backwards compatible. However, the devil is in the details. You likely will find things where conventions change, or specific libraries fall into or out of use.

这篇关于是新的C ++向后兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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