1

I recently read the Google C++ Style Guide and especially one part catched my eye.

The part about Rvalue References discourages from using std::forward in general and using rvalue references in other cases than defining the move assignment operator and constructor.

The only argument given for this is that these are complicated, diffcult to understand features.

Are there other arguments for avoiding these features?

5

No. The Google style guide makes no sense for anybody except Google. And even for them it's highly questionable. The best approach to take is to forget the Google Style Guide and everything you've read in it, because it's junk.

Rvalue references are a great and wonderful thing that drastically improved C++. Not using them will consign your code to the pits of Hell. They are the number one most important feature in C++11.

  • 2
    @Otomo: The reasoning behind the document is that Google have a bunch of C89 and decided that since their old code was shit, their new code had to be shit too to interoperate with it. – DeadMG Mar 5 '15 at 21:59
  • 1
    @RobertHarvey: The previous versions stated it more explicitly, but they still carry this: "In some cases there might be good arguments for changing certain style rules, but we nonetheless keep things as they are in order to preserve consistency." Of course I could also debate the merits of each rule individually with you if you prefer. – DeadMG Mar 5 '15 at 22:03
  • 1
    There seem to be quite some good rules hidden in it. So I doubt you can demolish them all. I guess the saying about the blind chickens applies to the guide... – Deduplicator Mar 5 '15 at 22:30
  • 1
    @Deduplicator: There's nothing in the guide that's useful for an experienced C++ programmer, and if you're a new C++ programmer the shit will do far more damage than it's worth. – DeadMG Mar 5 '15 at 22:33
  • 1
    Line length. Are there still style guides that talk about that, in an era of 1920 pixel width monitors? – Robert Harvey Mar 6 '15 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.