You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/05/04 22:52:03 UTC

svn commit: r1677682 [3/3] - in /mesos/site: publish/ publish/blog/ publish/blog/mesos-0-21-0-released/ publish/documentation/latest/mesos-c++-style-guide/ publish/documentation/latest/release-guide/ publish/documentation/mesos-c++-style-guide/ publish...

Modified: mesos/site/source/blog/2014-11-17-mesos-0-21-0-released.md
URL: http://svn.apache.org/viewvc/mesos/site/source/blog/2014-11-17-mesos-0-21-0-released.md?rev=1677682&r1=1677681&r2=1677682&view=diff
==============================================================================
--- mesos/site/source/blog/2014-11-17-mesos-0-21-0-released.md (original)
+++ mesos/site/source/blog/2014-11-17-mesos-0-21-0-released.md Mon May  4 20:52:03 2015
@@ -14,7 +14,7 @@ The latest Mesos release, 0.21.0, is now
 * Task reconciliation for frameworks ([MESOS-1407](https://issues.apache.org/jira/browse/MESOS-1407))
 * Support for Mesos modules ([MESOS-1931](https://issues.apache.org/jira/browse/MESOS-1931))
 * Task status now includes source and reason ([MESOS-343](https://issues.apache.org/jira/browse/MESOS-343), [MESOS-1143](https://issues.apache.org/jira/browse/MESOS-1143))
-* A shared filesystem isolator ([MESOS-1586](https://issues.apache.org/jira/browse/MESOS-1143))
+* A shared filesystem isolator ([MESOS-1586](https://issues.apache.org/jira/browse/MESOS-1586))
 * A pid namespace isolator ([MESOS-1765](https://issues.apache.org/jira/browse/MESOS-1765))
 
 Full release notes are available in the release [CHANGELOG](https://github.com/apache/mesos/blob/master/CHANGELOG).

Modified: mesos/site/source/documentation/latest/mesos-c++-style-guide.md
URL: http://svn.apache.org/viewvc/mesos/site/source/documentation/latest/mesos-c%2B%2B-style-guide.md?rev=1677682&r1=1677681&r2=1677682&view=diff
==============================================================================
--- mesos/site/source/documentation/latest/mesos-c++-style-guide.md (original)
+++ mesos/site/source/documentation/latest/mesos-c++-style-guide.md Mon May  4 20:52:03 2015
@@ -99,7 +99,7 @@ allocator->resourcesRecovered(
 * Newline for an assignment statement: indent with 2 spaces.
 
 ```
-Try<Duration> failoverTimeout =
+Try<Duration> failoverTimeout =
   Duration::create(FrameworkInfo().failover_timeout());
 ```
 
@@ -110,7 +110,7 @@ Try&lt;Duration&gt; failoverTimeout =
 
 ## C++11
 
-We still support older compilers. The whitelist of supported C++11 features is:
+We support C++11 and require GCC 4.8+ or Clang 3.5+ compilers. The whitelist of supported C++11 features is:
 
 * Static assertions.
 * Multiple right angle brackets.
@@ -130,7 +130,7 @@ shared_ptr<list<string>> names = shared_
 // 3: Don't use.
 auto authorizer = LocalAuthorizer::create(acls);
 // Compare with
-Try&lt;Owned&lt;LocalAuthorizer>> authorizer = LocalAuthorizer::create();
+Try<Owned<LocalAuthorizer>> authorizer = LocalAuthorizer::create();
 ```
 
 * Rvalue references.
@@ -142,3 +142,269 @@ Try&lt;Owned&lt;LocalAuthorizer>> author
 * Shared from this.
   * `class T : public std::enable_shared_from_this<T>`
   * `shared_from_this()`
+* Lambdas!
+  * Don't put a space between the capture list and the parameter list:
+
+    ```
+    // 1: OK.
+    []() { ...; };
+
+    // 2: Don't use.
+    [] () { ...; };
+    ```
+
+  * Prefer default capture by value, explicit capture by value, then capture by reference. To avoid dangling-pointer bugs, *never* use default capture by reference:
+
+    ```
+    // 1: OK.
+    [=]() { ... }; // Default capture by value.
+    [n]() { ... }; // Explicit capture by value.
+    [&n]() { ... }; // Explicit capture by reference.
+    [=, &n]() { ... }; // Default capture by value, explicit capture by reference.
+
+    // 2: Don't use.
+    [&]() { ... }; // Default capture by reference.
+    ```
+
+  * Use `mutable` only when absolutely necessary.
+
+    ```
+    // 1: OK.
+    []() mutable { ...; };
+    ```
+
+  * Feel free to ignore the return type by default, adding it as necessary to appease the compiler or be more explicit for the reader.
+
+    ```
+    // 1: OK.
+    []() { return true; };
+    []() -> bool { return ambiguous(); };
+    ```
+
+  * Feel free to use `auto` when naming a lambda expression:
+
+    ```
+    // 1: OK.
+    auto lambda = []() { ...; };
+    ```
+
+  * Format lambdas similar to how we format functions and methods. Feel free to let lambdas be one-liners:
+
+    ```
+    // 1: OK.
+    auto lambda = []() {
+      ...;
+    };
+
+    // 2: OK.
+    auto lambda = []() { ...; };
+    ```
+
+    Feel free to inline lambdas within function arguments:
+
+    ```
+    socket.send([]() {
+      ...;
+    });
+    ```
+
+    Chain function calls on a newline after the closing brace of the lambda and the closing parenthesis of function call:
+
+    ```
+    // 1: OK.
+    instance
+      .method([]() {
+        ...;
+      })
+      .then([]() { ...; })
+      .then([]() {
+        ...;
+      });
+
+    // 2: OK (when no chaining, compare to 1).
+    instance.method([]() {
+      ...;
+    });
+
+    // 3: OK (if no 'instance.method').
+    function([]() {
+      ...;
+    })
+    .then([]() { ...; })
+    .then([]() {
+      ...;
+    });
+
+    // 3: OK (but prefer 1).
+    instance.method([]() {
+      ...;
+    })
+    .then([]() { ...; })
+    .then([]() {
+      ...;
+    });
+    ```
+
+    Wrap capture lists indepedently of parameters, *use the same formatting as if the capture list were template parameters*:
+
+
+    ```
+    // 1: OK.
+    function([&capture1, &capture2, &capture3](
+        const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    });
+
+    function(
+        [&capture1, &capture2, &capture3](
+            const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    });
+
+    auto lambda = [&capture1, &capture2, &capture3](
+        const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    };
+
+
+    auto lambda =
+      [&capture1, &capture2, &capture3](
+          const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    };
+
+    // 2: OK (when capture list is longer than 80 characters).
+    function([
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](
+            const T1& p1, const T2& p2) {
+      ...;
+    });
+
+    auto lambda = [
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](
+            const T1& p1, const T2& p2) {
+      ...;
+    };
+
+    // 3: OK (but prefer 2).
+    function([
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](const T1& p1, const T2& t2) {
+      ...;
+    });
+
+    auto lambda = [
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](const T1& p1, const T2& p2) {
+      ...;
+    };
+
+    // 3: Don't use.
+    function([&capture1,
+              &capture2,
+              &capture3,
+              &capture4](const T1& p1, const T2& p2) {
+      ...;
+    });
+
+    auto lambda = [&capture1,
+                   &capture2,
+                   &capture3,
+                   &capture4](const T1& p1, const T2& p2) {
+      ...;
+    };
+
+    // 4: Don't use.
+    function([&capture1,
+              &capture2,
+              &capture3,
+              &capture4](
+        const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    });
+
+    auto lambda = [&capture1,
+                   &capture2,
+                   &capture3,
+                   &capture4](
+        const T1& p1, const T2& p2, const T3& p3) {
+      ...;
+    };
+
+    // 5: Don't use.
+    function([&capture1,
+              &capture2,
+              &capture3,
+              &capture4](
+        const T1& p1,
+        const T2& p2,
+        const T3& p3) {
+      ...;
+    });
+
+    auto lambda = [&capture1,
+                   &capture2,
+                   &capture3,
+                   &capture4](
+        const T1& p1,
+        const T2& p2,
+        const T3& p3) {
+      ...;
+    };
+
+    // 6: OK (parameter list longer than 80 characters).
+    function([&capture1, &capture2, &capture3](
+        const T1& p1,
+        const T2& p2,
+        const T3& p3,
+        const T4& p4) {
+      ...;
+    });
+
+    auto lambda = [&capture1, &capture2, &capture3](
+        const T1& p1,
+        const T2& p2,
+        const T3& p3,
+        const T4& p4) {
+      ...;
+    };
+
+    // 7: OK (capture and parameter lists longer than 80 characters).
+    function([
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](
+            const T1& p1,
+            const T2& p2,
+            const T3& p3,
+            const T4& p4) {
+      ...;
+    });
+
+    auto lambda = [
+        &capture1,
+        &capture2,
+        &capture3,
+        &capture4](
+            const T1& p1,
+            const T2& p2,
+            const T3& p3,
+            const T4& p4) {
+      ...;
+    };
+    ```
+
+* Unrestricted Union.
+
+  Like the pre-existing `union`, we can overlap storage allocation for objects that never exist simultaneously. However, with C++11 we are no longer *restricted to having only non-POD types in unions*. Adding non-POD types to unions complicates things, however, because we need to make sure to properly call constructors and destructors. Therefore, only use unrestricted unions (i.e., unions with non-POD types) when the union has only a single field. What does this buy us? Now we can avoid dynamic memory allocations for "container" like types, e.g., `Option`, `Try`, `Result`, etc. In effect, we treat the union like a dynamic allocation, calling *placement new*, `new (&t) T(...)` anyplace we would have just called `new T(...)` and the destructor `t.~T()` anyplace we would have called `delete t`.

Modified: mesos/site/source/documentation/latest/release-guide.md
URL: http://svn.apache.org/viewvc/mesos/site/source/documentation/latest/release-guide.md?rev=1677682&r1=1677681&r2=1677682&view=diff
==============================================================================
--- mesos/site/source/documentation/latest/release-guide.md (original)
+++ mesos/site/source/documentation/latest/release-guide.md Mon May  4 20:52:03 2015
@@ -104,7 +104,7 @@ This guide describes the process of doin
 ## Voting the release candidate
 
 1. Once a release candidate is deemed worthy to be officially released you should call a vote on
-   the `dev@meosos.apache.org` (and optionally `user@mesos.apache.org`) mailing list.
+   the `dev@mesos.apache.org` (and optionally `user@mesos.apache.org`) mailing list.
 
 2. It is recommended to use the `support/vote.sh` script to vote the release candidate.