Commit Graph

2121 Commits (4ad63d7d34717fe7581310ee73f49591cc44d75c)
 

Author SHA1 Message Date
Herb Sutter 3c1991b87b Updated T.68 example 5 years ago
Herb Sutter 520ac9c695 Updated the new ES.3
Added xref, massaged summary.
5 years ago
shaneasd 627ed66ce6
Update reference to SF.7 to match text (#1735) 5 years ago
Florian Behrens c142bc9d7e
Improve example in CP.4 to not contradict F.53. (#1724)
Changed the example so that objects are not passed by reference to other thread contexts (though threads are properly synchronized).
5 years ago
peno2 b5412f5922
Add new rule ES.3 Don't repeat yourself (#1715)
* Add new rule ES.3 Don't repeat yourself

* Replace function example with more inclusive/neutral language

Add a reference to topic on libraries.
5 years ago
Sergey Zubkov 2c95a33fef travis CI fixes 5 years ago
David Leal cef2f6bb77
Replace Travis CI with GitHub Actions (#1688) 5 years ago
Niels Dekker e2c0f23ce1
F.60: Remove C-style cast (T&) from example of invalid C++ (#1711) 5 years ago
Herb Sutter a6eb40c5a2 Improved F.7 lifetime note; closes #1698 5 years ago
Herb Sutter 5fdddf821d Added a justification message option for `gsl::suppress`
Closes #1703
5 years ago
Herb Sutter 53aaebb074 Updated Mozilla link and Google style guide C++ version note
Closes #1705
5 years ago
Fernando J. Iglesias García 525d8f225e
Update C.83 with swap for resource mgmt. (#1694)
* Update C.83 with swap for resource mgmt.

The swap is useful to implement assignments idiomatically (e.g. copy-swap idiom).

With the current enforcement, to non-virtual classes, very simple classes (e.g. `trivially_copyable`, a struct encapsulating an stl container) are suggested to have a swap. This suggestion can be argued wrong since for very simple classes copy-swap idiom is not efficient (the creation of a third object on assignment is not needed, which copy-swap does).

* Rework C.83 according to PR comments.
5 years ago
Sergey Zubkov 840fa592ac
merge C.150 in R.23, leaving a redirect behind (#1676) 5 years ago
hsutter dd98129f40 Fixes example in ES.105, closes #1678 5 years ago
hsutter 6ad29ce609 Fixes ES.50 example and closes #1682
Also removes the only use of `decltype` in the Guidelines, FTW.
5 years ago
Herb Sutter 55bea2089b
Remove string_span, recommend using `std::string_view`, `std:::span,<char>` or `gsl::span<char>` instead (#1680) 5 years ago
Herb Sutter 146864fe89
Cleaned up casting guidance (#1685)
The various guidelines now have consistent Enforcements.
All C-style casts are now consistently banned, including to `(void)`.
Cast to `(void`)` should be `std::ignore =` instead.
All functional-style casts are now consistently banned,  instead of
`T(x)` use `T{x}`.
5 years ago
Sergey Zubkov 86102531dc
merge C.151 into R.22, leaving a redirect behind (#1675) 5 years ago
Sergey Zubkov 30b41c32e3
merge R.30 and F.7, closes #1671 (#1674) 5 years ago
hsutter c86be249f3 Revert "Revert "Revert "Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead"""
This reverts commit 8241609450.
5 years ago
hsutter 8241609450 Revert "Revert "Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead""
This reverts commit f15ee43ad6.
5 years ago
hsutter f15ee43ad6 Revert "Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead"
This reverts commit 5257915dee.
5 years ago
hsutter 5257915dee Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead 5 years ago
Gabriel Dos Reis ab34c8b6b0
Merge pull request #1679 from N-Dekker/E.30-Remove-suggestion-to-use-throw()
E.30: Remove suggestion to use `throw()`
5 years ago
Niels Dekker 0d46b2006c E.30: Remove suggestion to use `throw()`
Removed the suggestion to use `throw()` from E.30 ("Don't use exception specifications"), as it was deprecated by C++11, and is rejected by C++20.
5 years ago
hsutter 2e3f983971 Restored whitespace after "might"
Fixing previous commit where we ate the whitespace after "may" in four
places (yay regex search `might[^\s]`)
5 years ago
hsutter 75406a2db8 Remove "may" except for the month name -- closes #1542
In English, the word "may" is overloaded and ambiguous. This commit
changes it to "might" wherever possible, otherwise more specific
meanings like "can," "could," or especially "must" ("may not" -> "must
not" when that is intended).
5 years ago
David B fae4ed3768
ES.103 examples updated, addresses Issue #1656 (#1659)
* ES.103 examples updated, addresses Issue #1656

* Fix cpplint report: Res-overflow0.cpp:18:  Missing spaces around <=  [whitespace/operators] [3]
5 years ago
rjhcnf bdccf49849
added minor clarification. (#1672)
* added minor clarification.

* Update CppCoreGuidelines.md

Updated comment.

* Update CppCoreGuidelines.md
5 years ago
Gabriel Dos Reis 739dc98dff
Merge pull request #1664 from johnmcfarlane/patch-1
Add clarifying example to SF.12
5 years ago
John McFarlane c5a771832a
Add clarifying example to SF.12
The examples in SF.12 are likely to encourage readers to always use the `""` form of `'#include` when including headers from the same project ([discussion](https://github.com/isocpp/CppCoreGuidelines/pull/1596#issuecomment-673266275)). However, in larger projects this may not always be appropriate; `<>` should be used for includes located via a header search path.

This proposed solution adds an example of the later, i.e. where `<>` is used to include a header from the same project.
5 years ago
David B bd7085e53e
Change [C++CS] refs to [SuttAlex05] Issue #1660 (#1662) 5 years ago
Sergey Zubkov 2449d5d60f E.27: make example compile, closes #1622 6 years ago
hsutter 0439326363 Closes #1579 6 years ago
hsutter 945b34d40e Closes #1574
- Add a cross-reference to C.139 and note that it doesn't matter whether
a function is declared with override or final if the whole class is
already final.
- Fix C.139 to make it clearer that it's about `final` on classes.
6 years ago
hsutter 63e2cd0ecd Closes #1585 6 years ago
Sergey Zubkov 01fa6a9bcf R.31 mark Example as Example, bad (closes #1651) 6 years ago
LE GARREC Vincent 6d17d10604
T.5: Add an example for Type erasure (#1625)
Based on :
https://www.modernescpp.com/index.php/c-core-guidelines-type-erasure-with-templates

Co-authored-by: Vincent Legarrec <vincent.legarrec@csdental.com>
6 years ago
cadenzasong d4e2281a09
removed extra space in an example in CP.2 (#1654) 6 years ago
Gabriel Dos Reis 6f50150e94
Merge pull request #1596 from apenn-msft/patch-1
SF.12: Prefer the quoted form of `#include` for files relative to the…
6 years ago
apenn-msft 94d6123c9a
relative path should be from within the same component
... files that exist at a relative path to the file containing the `#include` statement (from within the same component or project)
6 years ago
apenn-msft f458adae1f
Update CppCoreGuidelines.md
explicitly note that "file" refers to as it exists in the location of it being authored/modified.
this is to address any confusion about #including "bar.h" from foo.h based on whether bar.h is relative to foo.h at the time and location foo.h is being modified (e.g. under mylib/foo.h) versus at the time/location from which foo.h is installed to the system and included by the user (e.g. from /usr/include).
6 years ago
Hugh Macdonald d996c97809
Fix typo in SL.str.1 (#1648)
Part of SL.str.1 references replacing “const string*” with “string_view”, but the example code above shows “const string&” instead.
This changes the comment to the reference rather than pointer.
6 years ago
hsutter 12f29f2ea9 Closes #1647 6 years ago
Sergey Zubkov 895d709546 NR.5: note that example is incomplete (closes #1643) 6 years ago
al-mission-2016 c6262ea1a8
+= structured bindings mentioning; -= '\n' (#1646)
It worth to mention the *structured bindings* right in the *Reason* section.
6 years ago
Sergey Zubkov 72fba35f33 travis CI fix 6 years ago
hsutter 43bbde7fc9 Committing PR #1640 to main branch 6 years ago
Sergey Zubkov ac7079b012 travis CI fix 6 years ago
Arthur O'Dwyer 567331ab4e
Const-qualify operator()s. NFC. (#1638)
As a general rule, `operator()` should be const-qualified.
The exceptions are few and far between.

I was actually looking for a Guideline on that subject;
I grepped for `operator()` and found that not only is there
no such Guideline yet, the doc actually contained these
places that (needlessly) violated the general rule.
6 years ago