Simplify ctors with default member initializer
Needs RevisionPublic

Authored by gawin on Fri, Aug 9, 12:33 AM.

Details

Reviewers
cullmann
Group Reviewers
Kate
Summary

In my experience it has these advantages:

  • harder type checks,
  • allows to use = default ctor,
  • simplify ctors.

// I hope this time, I've created "ok" diff.

Diff Detail

Repository
R40 Kate
Lint
Lint Skipped
Unit
Unit Tests Skipped
gawin created this revision.Fri, Aug 9, 12:33 AM
Restricted Application added a subscriber: kwrite-devel. · View Herald TranscriptFri, Aug 9, 12:33 AM
gawin requested review of this revision.Fri, Aug 9, 12:33 AM
cullmann accepted this revision.Fri, Aug 9, 6:02 AM
cullmann added a subscriber: cullmann.

Looks good for me, thanks!

This revision is now accepted and ready to land.Fri, Aug 9, 6:02 AM

Can you pass me name + author for the git commit?

Did you make these changes manually, or use clang-tidy for it?
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html

Personally, I would prefer the = member init syntax over the braced initialization. This is how we did it in most other cases already as well where we use in-class member initialization.

gawin added a comment.Fri, Aug 9, 9:35 AM

@cullmann: Filip Gawin, filip.gawin@zoho.com

@dhaumann: yeah, clang-tidy. Isn't {} syntax better, I mean it prevents implicit conversion? (But yeah meaningless with pointers.)

@gawin: hello; how are you creating the diff? if you haven't used arc diff, that could be one reason why the commit authorship is messed up.

cullmann requested changes to this revision.Tue, Aug 13, 7:58 PM

I think Dominik is right and = would be nicer.

This revision now requires changes to proceed.Tue, Aug 13, 7:58 PM
kfunk added a subscriber: kfunk.Wed, Aug 14, 2:03 PM

I think Dominik is right and = would be nicer.

Note there's this UseAssignment option in the clang-tidy checker you can (and should) use. Just trying to preserve you from having to go through the diff manually :)