scummvm/scummvm — pull request #301 by lordhoto (2013-01-24 16:56:46+00:00)
Title: RFC: Allow use of override and nullptr. Also allow C++11 compilation.

This pull requests adds the possibility to compile ScummVM as C++11. It furthermore allows us to use override (see this for a brief introduction: https://en.wikipedia.org/wiki/C%2B%2B11#Explicit_overrides_and_final) and nullptr as constant, even on pre-C++11 compilers. For this override is #defined as 0, while override is #defined to nothing. The real motivation is override here. I only added nullptr, since I got asked about this in the past.

The benefit of having override is that you can have the compiler check that you actually override a method from a base class. This is helpful if you change the type of a method in the base class. There are cases when this would not result in compilation issues of subclasses. Instead on runtime the wrong method would be called. If you had flagged the method of the subclass with override, the compiler would error out if it does not find any method it actually overrides.

For example 4d3ecbfcd2aabf0885df978e6e44ef8b8256c657 would have uncovered that e016e7dfc2b1e3cdb39c01d81c5a34eee66a277b forgot to update the voicePlay type in SoundTownsPC98_v2 and SoundAmiga.

It's needless to say you can only benefit from this if your compiler supports this C++11 feature. clang and gcc do that.

This pull request also fixes a long list of C++11 related compatibility warnings, which would otherwise result in compilation errors in real C++11 mode.

I did not decide whether we actually want/need this yet. So I refrained from adapting our common code to use override. If we choose to merge this, we can easily do that. Adding a buildbot target for C++11 would be a good idea then too.

So this one is for open discussion.