Bug 178528 - Use "= default" to denote default constructor or destructor
Summary: Use "= default" to denote default constructor or destructor
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-19 11:56 PDT by Daniel Bates
Modified: 2017-11-15 13:02 PST (History)
3 users (show)

See Also:


Attachments
Patch (564.37 KB, patch)
2017-10-19 12:13 PDT, Daniel Bates
aestes: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2017-10-19 11:56:44 PDT
Use "= default" to denote default constructor or destructor instead of defining an empty function. This helps makes default constructors/destructors stand out from other functions as well as makes them searchable.
Comment 1 Daniel Bates 2017-10-19 12:13:23 PDT
Created attachment 324261 [details]
Patch

This a large change. ItIt is entirely mechanical. Mark default constructors and destructors with "= default" and remove their body. With the exception of Payment.h I left unnecesary explicit declarations of constructors and destructors in the code to keep this patch as consistent as possible to hopefully make it easy to review. In a follow up patch we can remove such declarations as the compiler will generate these functions for us.
Comment 2 Daniel Bates 2017-10-19 16:49:03 PDT
Committed r223728: <https://trac.webkit.org/changeset/223728>
Comment 3 Joseph Pecoraro 2017-10-22 18:14:50 PDT
Is there an advantage to this?
Comment 4 Daniel Bates 2017-10-22 19:38:01 PDT
(In reply to Joseph Pecoraro from comment #3)
> Is there an advantage to this?

https://stackoverflow.com/questions/20828907/the-new-keyword-default-in-c11
Comment 5 Joseph Pecoraro 2017-10-23 11:50:47 PDT
(In reply to Daniel Bates from comment #4)
> (In reply to Joseph Pecoraro from comment #3)
> > Is there an advantage to this?
> 
> https://stackoverflow.com/questions/20828907/the-new-keyword-default-in-c11

Thanks.

Something to this effect should absolutely have been in the ChangeLog explaining why this change was made.

The reason stated in the bugzilla bug was "This helps makes default constructors/destructors stand out from other functions as well as makes them searchable." which is not the same justification as the link you provided, nor would I necessarily agree with it. But using `= default` to make some classes be treated as POD / Trivial is an observable change that we might benefit from.
Comment 6 Radar WebKit Bug Importer 2017-11-15 13:02:16 PST
<rdar://problem/35568661>