Transition to C ++ 11

I am working on a product that uses C ++, primarily for its main components. Although it uses visual C ++ as the main compiler for the Windows platform, its editor and debugger as the main development environment does not use any specific Microsoft technologies. For other platforms, it uses gcc to compile.

My code base makes heavy use of the emulated rvalue reference (using the accelerated library), variable templates (using the boost processor), and in some cases expression templates.

I am tempted to switch to C ++ 11 to get a cleaner code base using the rvalue link, perfect forwarding, by default, and delete for constructors, variable templates, as well as auto and decltype.

If I do this, I can work on the existing code a bit to simplify it (using the template alias and maybe constexpr). In this case, I need to switch to gcc for the Windows platform using mingw, since the visual studio does not have an implementation for defaults and deletions, as well as a variation template. I also need to switch to gdb as a debugger and another code editor.

For me, the advantages look huge in terms of simplicity and code performance, however, stability, accessibility (on some platforms such as Android), debugging (switching from visual studio to gdb, since we have many visualization tools designed for the visual studio debugger) and a code editor (not as much as for large code of templates. I do not find much use of autocomplete, refactoring, etc., but code words, code blocks, qt creator works well with our build system) are some of problems.

I like to know if any of the medium or large-scale projects use commercial or open source, use or use any of the above C ++ 11 features? And how much effort is required for such a migration?

Any practical experience, advice or words of wisdom will help me make a decision.

+7
source share
1 answer

First of all: it depends on the policy.

Like all technologies, the transition from something that works to something new is a risk in itself. Depending on your thinking and criticism of your project, the degree of risk you accept may vary (for example, I use the top of the Clang version tree for personal projects, but mature gcc at work).

Personally, I would recommend not diving primarily for finished projects, but instead perform a phased selection of functions that work.

You mentioned:

  • rvalue links and flawless redirects
  • default / delete
  • variadic templates
  • type inference ( auto / decltype )
  • template aliases and constexpr

VC ++ 11 supports the support of many C ++ 11 features . For example, you can start using rvalue links and enter the output type right now. And they can be used with the gcc 4.5.x branch, if I remember correctly that it's been over a year now, it wears out so well.

One notable absence on your list are lambdas, for example, which are supported by both VC ++ 11 and gcc.

If you want to move on, you have to switch the compiler and the environment. The effort is much greater, since you will need to retrain the team (personally, I had warts from gdb to mingw ...).

I would recommend cherry picking what works on both compilers until you feel adventurous. Migration is always a risk to business.

+7
source

All Articles