Commit Graph

2119 Commits

Author SHA1 Message Date
apenn-msft
2a3690d1e3
Use portable header identifiers (#2149)
* SF.13  Use portable header identifiers in `#include` statements

add a new rule governing how to compose portable header path identifiers such that they respect proper casing (<vector>, not <VECTOR>) and portable path separators ('/')

* anchor

* fix typos

* fix warnings

* nit

* nit

* nit

* normalize on 'util'

* clean up wording

* Update CppCoreGuidelines.md

---------

Co-authored-by: Herb Sutter <herb.sutter@gmail.com>
2023-10-12 12:32:05 -07:00
Werner Henze
2d87c45e4b
ES.23: change example code to better match the rule (#2150)
The example suggests that `int z = gsl::narrow_cast<int>(7.9);;` is OK. The rule says "Use `=` only when you are sure that there can be no narrowing conversions.", which matches, but is also says "For built-in arithmetic types, use `=` only with `auto`.", and this is not respected here. So replace the one line with both possibilities suggested by the rule.

Co-authored-by: Werner Henze <w.henze@avm.de>
2023-10-12 12:25:52 -07:00
Werner Henze
a43285d95a
Make example code adhere to C.65 (#2151)
C.65 requires move assignment to be safe for self-assignment. The given example is not safe for self-assignment as given right now. This commit fixes this.

Co-authored-by: Werner Henze <w.henze@avm.de>
2023-10-12 12:23:59 -07:00
Raymond Chen
27e662bebb
ES.61 clarify wording (#2137)
The original text was "If the `new` and the `delete` are in the same scope, mistakes can be flagged." This has been [misinterpreted](https://stackoverflow.com/q/75905524) to mean "Any `new` and `delete` in the same scope is a mistake and should be flagged."

Reword the Enforcement clauses to follow the pattern established by the other Enforcement clauses: "Flag (bad thing)". Also, call the issue a "mismatch" rather than a "mistake", so that it is more clear that the underlying issue is the mismatch between scalar and array new/deletion.
2023-09-28 15:00:36 -07:00
Timm Knape
5eb1467d5e
I.12: use a const string as mentioned in the text 2023-09-18 13:40:08 -04:00
antcolag
b43874936f
ES.34: use the previously declared "const char * is" 2023-08-28 00:06:14 -04:00
bgloyer
b5adbd2564
F_3 void auto (#2125) 2023-08-17 22:04:37 -04:00
MikhailBerezhanov
7c9dd4dda8
dual hierarchy example: interface hierarchies fix (#2122)
Co-authored-by: Mikhail Berezhanov <mpb@martistel.com>
2023-08-14 10:45:43 -04:00
Xavier1113
e1b17ec9a5
C.181 Fix missing type specifier (#2117) 2023-08-07 14:06:08 -04:00
Xavier1113
f2485c56a1
Fix variable name in example (#2116) 2023-08-06 01:25:02 -04:00
Eisenwave
efbc482f0d
Fix missing noexcept specifiers (#2102) 2023-07-04 22:32:22 -04:00
Eisenwave
892b8ea7f3
fix stray inline link (#2104) 2023-06-24 23:45:30 -04:00
Eisenwave
fe3e83e648
fix memory leak in example of C.66 (#2096) 2023-06-24 23:40:24 -04:00
Eisenwave
b11fbd0195
replace "modulo arithmetic" with "modular arithmetic" (#2088) 2023-06-23 23:42:15 -04:00
Eisenwave
68f56f0a34
fix missing return *this (#2097) 2023-06-23 23:39:17 -04:00
Eisenwave
95aca76777
add spaces in requires expressions (#2098) 2023-06-23 23:38:55 -04:00
Eisenwave
a80c2a6f36
fix ill-formed example C.65 (missing noexcept on declaration) (#2101) 2023-06-23 23:34:42 -04:00
Eisenwave
db079ab301
fix stray ellipsis (#2091) 2023-06-23 13:08:51 -04:00
Chris Cotter
1634e898b6
C++20 is more up to date than C++17 (#2085) 2023-06-22 12:25:52 -04:00
Sergey Zubkov
c17b4be1e8 RF.rules: archive AUTOSAR pdf link (closes #2070) 2023-05-04 17:16:52 -04:00
Kimi MA
f3d1b34462
remove redundant "what to do" (#2075) 2023-04-29 22:20:04 -04:00
Fernando J. Iglesias García
16f29fd38c
Use enum class in Enum.4 example. (#2065) 2023-04-13 23:26:43 -04:00
Sergey Zubkov
1d04d93dbe bump date and make CI happy 2023-04-13 23:20:52 -04:00
Herb Sutter
1b41448298 List some non-enum alternatives to macros in Enum.1, closes #2054 2023-04-13 14:51:03 -07:00
Herb Sutter
89a20b2cc8 Expand comment about why P.3 'bad' code is unclear, closes #2058 2023-04-13 14:42:41 -07:00
Herb Sutter
3c90d590e1 Allow [&] capture default when also capturing this, closes #2060 2023-04-13 14:33:21 -07:00
bgloyer
0d70ae927d
SL_3 'Do not add non-standard entities to namespace std' add example (#2031)
* SL_3 add example

* Update isocpp.dic

add My_Vector
2023-03-30 14:18:53 -07:00
Henrique Mageste
6a0b5e6eca
Abstract class needs at least one abstract method to be considered abstract (#2053)
The introduction of the method is needed, for instance, for constructions like std::is_abstract<AbstractBase>::value to be evaluated to true
2023-03-30 14:17:31 -07:00
Herb Sutter
696633572c Remove spurious Enforcement, closes #2061 2023-03-30 14:14:19 -07:00
Florian Bramer
a3ae12b20e
Fixed typo (#2055)
Section C.21 shows a code example which typed
a class name in two different ways:

- CloneableBase
- ClonableBase

It is easy to overlook but it would not compile.

My commit prefers CloneableBase over ClonableBase and uses just that
name then. I prefered CloneableBase because Java's SDK uses the same
writing, so I guess this can be consired to be more widely used.
2023-03-15 23:03:52 -04:00
Tim Lyon
8e3723f18f
Fix typo (#2051) 2023-02-24 12:41:01 -05:00
Xeverous
e80373f226
fix typo in code example in C.43 (#2040) 2023-02-17 11:31:31 -05:00
ancestor-mithril
e1a453b0b0
Fix broken anchors (#2038)
* Standard library and GSL anchors do not work anymore.
2023-02-17 11:31:07 -05:00
Chris Cotter
938452179c
Fix minor typo in ES.59 (#2037) 2023-02-12 13:46:45 -05:00
Hyuk Myeong
efd59afe9c
Fix typos when using names (#2035)
* Fix typos when using names

* Update isocpp.dic
2023-02-10 15:13:18 -05:00
Sergey
31bb3d1b01
F.10: small code fix 2023-01-26 17:05:31 -05:00
Jonathan Wakely
6d912e8b51
CP.44 improve example and add more accurate discussion (#2028) 2023-01-26 11:29:02 -05:00
Herb Sutter
da8a6fbd37 Make C.12 title consistent 2023-01-19 14:43:11 -08:00
Herb Sutter
06fabdc9af Update C.12 to apply to copyable/movable types, closes #2012 2023-01-19 14:42:25 -08:00
Herb Sutter
0bc56ffaa8 s/instead follow/follow/ for #2010 2023-01-19 14:17:29 -08:00
Russell McClellan
1ba3371a0d
Add exceptions to F.15, F.16, and F.18 for shared_ptr types (#2010)
Currently these guidelines conflict with R.34, R.35, and R.36.

This conflict has led to confusion, where it's unclear which
guidelines to prefer for `shared_ptr` types.

In a [previous
PR](https://github.com/isocpp/CppCoreGuidelines/pull/1989) I proposed
preferring the "F" series of guidelines.  This PR takes the opposite
approach and prefers the "R" guidelines for `shared_ptr` types.

I don't feel strongly about which guidelines to prefer, I just want to make
sure the guidelines are internally consistent.
2023-01-19 14:16:39 -08:00
Hyuk Myeong
fa31c19979
Fix minor typos (#2022)
* Fix minor typos

Fix minor typos

* Update isocpp.dic
2023-01-19 14:04:14 -08:00
Sergey Zubkov
4b706d9d6d satisfy travis ci 2023-01-15 10:53:11 -05:00
Herb Sutter
17b68f14f6 Describe capture-lists and update F.19 forwarding enforcement, updates #2016 and closes #2017 2023-01-12 16:24:01 -08:00
Chris Cotter
1748ebb45a
Editorial - use "capture default" for syntactic element (#2016) 2023-01-12 14:13:35 -08:00
Kimi MA
12ad22b024
non-built-in -> built-in (#2015) 2023-01-05 17:10:06 -05:00
Kimi MA
9028b62106
R.33 add missing space in the title (#2014) 2022-12-23 08:57:35 -05:00
Arkady Shapkin
ee8d9ab216
Clarify F.16 enforcement rule about passing by value (#2008) 2022-12-15 14:05:14 -08:00
Sergey Zubkov
fb112c7281 make CI happy 2022-12-09 15:13:22 -05:00
Herb Sutter
380a6ff26d Added span bounds-checking guarantee and a note about its relationship to std::span 2022-12-09 10:38:05 -08:00