[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
levin at chromium.org
levin at chromium.org
Wed Dec 22 14:39:50 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit ca7d22c72f09cb0cdf3ca4a6b5c467823eeb0ad2
Author: levin at chromium.org <levin at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 15 05:14:35 2010 +0000
Add guideline for constructors doing implicit type conversion to coding style.
https://bugs.webkit.org/show_bug.cgi?id=47646
Reviewed by Darin Adler.
* coding/coding-style.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitSite/ChangeLog b/WebKitSite/ChangeLog
index f55a58f..cea7e1d 100644
--- a/WebKitSite/ChangeLog
+++ b/WebKitSite/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-30 David Levin <levin at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ Add guideline for constructors doing implicit type conversion to coding style.
+ https://bugs.webkit.org/show_bug.cgi?id=47646
+
+ * coding/coding-style.html:
+
2010-10-01 Alex Mathews <possessedpenguinbob at gmail.com>
Reviewed by Simon Fraser.
diff --git a/WebKitSite/coding/coding-style.html b/WebKitSite/coding/coding-style.html
index 5afd780..9bcf019 100644
--- a/WebKitSite/coding/coding-style.html
+++ b/WebKitSite/coding/coding-style.html
@@ -939,6 +939,38 @@ using namespace std;
</ol>
+<h3>Classes</h3>
+
+<ol>
+<li>
+Use a constructor to do an implicit conversion when the argument is reasonably thought of as a type conversion and the type conversion is fast. Otherwise, use the explicit keyword or a function returning the type. This only applies to single argument constructors.
+<h4 class="right">Right:</h4>
+<pre class="code">
+class LargeInt {
+public:
+ LargeInt(int);
+...
+
+class Vector {
+public:
+ explicit Vector(int size); // Not a type conversion.
+ PassOwnPtr<Vector> create(Array); // Costly conversion.
+...
+
+</pre>
+
+<h4 class="wrong">Wrong:</h4>
+<pre class="code">
+class Task {
+public:
+ Task(ScriptExecutionContext*); // Not a type conversion.
+ explicit Task(); // No arguments.
+ explicit Task(ScriptExecutionContext*, Other); // More than one argument.
+...
+</pre>
+</li>
+</ol>
+
<?php
include("../footer.inc");
?>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list