Skip to content

Commit 67db011

Browse files
committed
Merge #8177: developer notes: updates for C++11
654a211 developer notes: updates for C++11 (Kaz Wesley)
2 parents ac8d041 + 654a211 commit 67db011

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

doc/developer-notes.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ General C++
265265
the `.h` to the `.cpp` should not result in build errors
266266

267267
- Use the RAII (Resource Acquisition Is Initialization) paradigm where possible. For example by using
268-
`scoped_pointer` for allocations in a function.
268+
`unique_ptr` for allocations in a function.
269269

270270
- *Rationale*: This avoids memory and resource leaks, and ensures exception safety
271271

@@ -284,10 +284,9 @@ C++ data structures
284284
- *Rationale*: Behavior is undefined. In C++ parlor this means "may reformat
285285
the universe", in practice this has resulted in at least one hard-to-debug crash bug
286286

287-
- Watch out for vector out-of-bounds exceptions. `&vch[0]` is illegal for an
288-
empty vector, `&vch[vch.size()]` is always illegal. Use `begin_ptr(vch)` and
289-
`end_ptr(vch)` to get the begin and end pointer instead (defined in
290-
`serialize.h`)
287+
- Watch out for out-of-bounds vector access. `&vch[vch.size()]` is illegal,
288+
including `&vch[0]` for an empty vector. Use `vch.data()` and `vch.data() +
289+
vch.size()` instead.
291290

292291
- Vector bounds checking is only enabled in debug mode. Do not rely on it
293292

0 commit comments

Comments
 (0)