mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-18 05:04:41 +03:00
Fix missing / bad indent or style within bullet list
This commit is contained in:
@@ -1764,7 +1764,6 @@ How big is a screen? Try 60 lines by 140 characters; that's roughly the maximum
|
||||
* Flag functions that are too complex. How complex is too complex?
|
||||
You could use cyclomatic complexity. Try "more that 10 logical path through." Count a simple switch as one path.
|
||||
|
||||
|
||||
<a name="Rf-constexpr"></a>
|
||||
### F.4: If a function may have to be evaluated at compile time, declare it `constexpr`
|
||||
|
||||
@@ -2124,7 +2123,6 @@ If you need the notion of an optional value, use a pointer, `std::optional`, or
|
||||
* (Simple) ((Foundation)) Warn when a parameter being passed by value has a size greater than `4*sizeof(int)`.
|
||||
Suggest using a `const` reference instead.
|
||||
|
||||
|
||||
<a name="Rf-T"></a>
|
||||
### F.21: Use a `T` parameter for a small object
|
||||
|
||||
@@ -2351,7 +2349,6 @@ rather than using the generic `tuple`.
|
||||
* Output parameters should be replaced by return values.
|
||||
An output parameter is one that the function writes to, invokes a non-`const` member function, or passes on as a non-`const`.
|
||||
|
||||
|
||||
<a name="Rf-return-ptr"></a>
|
||||
### F.42: Return a `T*` to indicate a position (only)
|
||||
|
||||
@@ -3170,7 +3167,6 @@ Here `p` refers to `pp` but does not own it.
|
||||
* (Hard) Determine if pointer or reference member variables are owners when there is no explicit statement of ownership
|
||||
(e.g., look into the constructors).
|
||||
|
||||
|
||||
<a name="Rc-dtor-ptr"></a>
|
||||
### C.32: If a class has a raw pointer (`T*`) or reference (`T&`), consider whether it might be owning
|
||||
|
||||
@@ -4019,7 +4015,6 @@ See [copy constructor vs. `clone()`](#Rc-copy-virtual).
|
||||
* (Moderate) An assignment operator should (implicitly or explicitly) invoke all base and member assignment operators.
|
||||
Look at the destructor to determine if the type has pointer semantics or value semantics.
|
||||
|
||||
|
||||
<a name="Rc-copy-semantic"></a>
|
||||
### C.61: A copy operation should copy
|
||||
|
||||
@@ -5704,7 +5699,6 @@ return a "smart pointer."
|
||||
* (Simple) Warn if a function returns an object that was allocated within the function but has a move constructor.
|
||||
Suggest considering returning it by value instead.
|
||||
|
||||
|
||||
<a name="Rr-ref"></a>
|
||||
### R.4: A raw reference (a `T&`) is non-owning
|
||||
|
||||
@@ -6101,7 +6095,6 @@ A function that does not manipulate lifetime should take raw pointers or referen
|
||||
* (Simple) Warn if a function takes a parameter of a type that is a `Unique_ptr` or `Shared_ptr` and the function only calls any of: `operator*`, `operator->` or `get()`).
|
||||
Suggest using a `T*` or `T&` instead.
|
||||
|
||||
|
||||
<a name="Rr-uniqueptrparam"></a>
|
||||
### R.33: Take a `unique_ptr<widget>` parameter to express that a function assumes ownership of a `widget`
|
||||
|
||||
@@ -11004,9 +10997,9 @@ Before a variable has been initialized, it does not contain a deterministic vali
|
||||
use(x2);
|
||||
|
||||
**Enforcement**:
|
||||
- Issue a diagnostic for any constructor of a non-trivially-constructible type that does not initialize all member variables. To fix: Write a data member initializer, or mention it in the member initializer list.
|
||||
- Issue a diagnostic when constructing an object of a trivially constructible type without `()` or `{}` to initialize its members. To fix: Add `()` or `{}`.
|
||||
|
||||
* Issue a diagnostic for any constructor of a non-trivially-constructible type that does not initialize all member variables. To fix: Write a data member initializer, or mention it in the member initializer list.
|
||||
* Issue a diagnostic when constructing an object of a trivially constructible type without `()` or `{}` to initialize its members. To fix: Add `()` or `{}`.
|
||||
|
||||
<a name="Pro-type-unions"></a>
|
||||
### Type.7: Avoid accessing members of raw unions. Prefer `variant` instead.
|
||||
@@ -11030,9 +11023,8 @@ Reading from a union member assumes that member was the last one written, and wr
|
||||
Note that just copying a union is not type-unsafe, so safe code can pass a union from one piece of unsafe code to another.
|
||||
|
||||
**Enforcement**:
|
||||
- Issue a diagnostic for accessing a member of a union. To fix: Use a `variant` instead.
|
||||
|
||||
|
||||
* Issue a diagnostic for accessing a member of a union. To fix: Use a `variant` instead.
|
||||
|
||||
<a name="Pro-type-varargs"></a>
|
||||
### Type.8: Avoid reading from varargs or passing vararg arguments. Prefer variadic template parameters instead.
|
||||
@@ -11063,10 +11055,9 @@ Reading from a vararg assumes that the correct type was actually passed. Passing
|
||||
Note: Declaring a `...` parameter is sometimes useful for techniques that don't involve actual argument passing, notably to declare “take-anything” functions so as to disable "everything else" in an overload set or express a catchall case in a template metaprogram.
|
||||
|
||||
**Enforcement**:
|
||||
- Issue a diagnostic for using `va_list`, `va_start`, or `va_arg`. To fix: Use a variadic template parameter list instead.
|
||||
- Issue a diagnostic for passing an argument to a vararg parameter. To fix: Use a different function, or `[[suppress(types)]]`.
|
||||
|
||||
|
||||
* Issue a diagnostic for using `va_list`, `va_start`, or `va_arg`. To fix: Use a variadic template parameter list instead.
|
||||
* Issue a diagnostic for passing an argument to a vararg parameter. To fix: Use a different function, or `[[suppress(types)]]`.
|
||||
|
||||
<a name="SS-bounds"></a>
|
||||
## Bounds safety profile
|
||||
@@ -11295,15 +11286,14 @@ These functions all have bounds-safe overloads that take `array_view`. Standard
|
||||
}
|
||||
|
||||
**Enforcement**:
|
||||
- Issue a diagnostic for any call to a standard library function that is not bounds-checked. ??? insert link to a list of banned functions
|
||||
|
||||
* Issue a diagnostic for any call to a standard library function that is not bounds-checked. ??? insert link to a list of banned functions
|
||||
|
||||
**TODO Notes**:
|
||||
- Impact on the standard library will require close coordination with WG21, if only to ensure compatibility even if never standardized.
|
||||
- We are considering specifying bounds-safe overloads for stdlib (especially C stdlib) functions like `memcmp` and shipping them in the GSL.
|
||||
- For existing stdlib functions and types like `vector` that are not fully bounds-checked, the goal is for these features to be bounds-checked when called from code with the bounds profile on, and unchecked when called from legacy code, possibly using constracts (concurrently being proposed by several WG21 members).
|
||||
|
||||
|
||||
|
||||
* Impact on the standard library will require close coordination with WG21, if only to ensure compatibility even if never standardized.
|
||||
* We are considering specifying bounds-safe overloads for stdlib (especially C stdlib) functions like `memcmp` and shipping them in the GSL.
|
||||
* For existing stdlib functions and types like `vector` that are not fully bounds-checked, the goal is for these features to be bounds-checked when called from code with the bounds profile on, and unchecked when called from legacy code, possibly using constracts (concurrently being proposed by several WG21 members).
|
||||
|
||||
<a name="SS-lifetime"></a>
|
||||
## Lifetime safety profile
|
||||
@@ -11396,7 +11386,6 @@ Use `not_null<zstring>` for C-style strings that cannot be `nullptr`. ??? Do we
|
||||
* `dyn_array<T>` // ??? needed ??? A heap-allocated array. The number of elements are determined at construction and fixed thereafter.
|
||||
The elements are mutable unless `T` is a `const` type. Basically an `array_view` that allocates and owns its elements.
|
||||
|
||||
|
||||
<a name="SS-assertions"></a>
|
||||
## GSL.assert: Assertions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user