Hi, Chromium-Devs,I cannot quite tell the reason of this style rule. As far as I can tell, it actually removes move constructors and move assignments silently and implicitly without any notifications in lots of our code.
Move constructor and move assignment operator are deleted if a destructor is provided.Though by using = default, we can still get compiler generated move constructor and assignment (Correct me if I made a mistake here), we do not always use = default to replace {}. (https://goo.gl/pZBsn1) And what's the point if I define a constructor or destructor just for = default?
--.Hzj_jie
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
On Tue, Nov 8, 2016 at 4:05 PM 'Zijie He' via Chromium-dev <chromi...@chromium.org> wrote:Hi, Chromium-Devs,I cannot quite tell the reason of this style rule. As far as I can tell, it actually removes move constructors and move assignments silently and implicitly without any notifications in lots of our code.Compiler-generated constructors and destructors are inlined. This can often result in surprisingly large amounts of code being emitted, since the destructors of your classes fields are also inlined, etc.
When the checks were originally written, we only checked for constructors / destructors / copy constructors (notably, not copy assignment operators). I'm not sure if we do it for move constructors / operators, but making the check consistent across these is a long-term goal of mine.Move constructor and move assignment operator are deleted if a destructor is provided.Though by using = default, we can still get compiler generated move constructor and assignment (Correct me if I made a mistake here), we do not always use = default to replace {}. (https://goo.gl/pZBsn1) And what's the point if I define a constructor or destructor just for = default?You can use = default, but the plugin will complain if you = default in the header file =)
As for the use of { }, that's because of lot of the codebase predated C++11.