Commit 98b4c4f5 authored by Kenton Varda's avatar Kenton Varda

Add style rule about implicit lambda captures.

parent c3b381ee
......@@ -378,6 +378,12 @@ The KJ and Cap'n Proto libraries are designed to function correctly when compile
We do NOT recommend disabling RTTI in your own code.
### Lambdas
Lamba capture lists must never use `=` to specify "capture all by value", because this makes it hard to review the capture list for possible lifetime issues.
Capture lists *may* use `&` ("capture all by reference") but *only* in cases where it is known that the lambda will not outlive the current stack frame. In fact, they generally *should* use `&` in this case, to make clear that there are no lifetime issues to think about.
### Use of Standard libraries
#### C++ Standard Library
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment