File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ General C++
265
265
the ` .h ` to the ` .cpp ` should not result in build errors
266
266
267
267
- 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.
269
269
270
270
- * Rationale* : This avoids memory and resource leaks, and ensures exception safety
271
271
@@ -284,10 +284,9 @@ C++ data structures
284
284
- * Rationale* : Behavior is undefined. In C++ parlor this means "may reformat
285
285
the universe", in practice this has resulted in at least one hard-to-debug crash bug
286
286
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.
291
290
292
291
- Vector bounds checking is only enabled in debug mode. Do not rely on it
293
292
You can’t perform that action at this time.
0 commit comments