Commit Graph

1903 Commits (cast-to-void-cleanup)

Author SHA1 Message Date
hsutter 45a68e8ac7 Cleaned up casting guidance
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}`.
2020-09-29 12:18:16 -07:00
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.
2020-09-23 15:41:22 -07:00
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.
2020-09-23 15:40:44 -07:00
hsutter f15ee43ad6 Revert "Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead"
This reverts commit 5257915dee.
2020-09-23 15:40:17 -07:00
hsutter 5257915dee Removed gsl::string_span, recommend using std::string_view, std::span<char>, or gsl::span<char> instead 2020-09-23 15:39:43 -07:00
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()`
2020-09-21 19:54:11 -07:00
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.
2020-09-21 19:16:05 +02:00
hsutter 2e3f983971 Restored whitespace after "might"
Fixing previous commit where we ate the whitespace after "may" in four
places (yay regex search `might[^\s]`)
2020-09-03 16:34:34 -07:00
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).
2020-09-03 12:57:06 -07:00
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]
2020-09-03 11:17:11 -07:00
rjhcnf bdccf49849
added minor clarification. (#1672)
* added minor clarification.

* Update CppCoreGuidelines.md

Updated comment.

* Update CppCoreGuidelines.md
2020-09-03 11:11:30 -07:00
Gabriel Dos Reis 739dc98dff
Merge pull request #1664 from johnmcfarlane/patch-1
Add clarifying example to SF.12
2020-08-16 08:35:09 -07:00
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.
2020-08-14 06:58:35 +02:00
David B bd7085e53e
Change [C++CS] refs to [SuttAlex05] Issue #1660 (#1662) 2020-08-12 13:37:57 -04:00
Sergey Zubkov 2449d5d60f E.27: make example compile, closes #1622 2020-08-03 16:48:37 -04:00
hsutter 0439326363 Closes #1579 2020-07-30 12:13:07 -07:00
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.
2020-07-30 11:32:36 -07:00
hsutter 63e2cd0ecd Closes #1585 2020-07-30 11:22:00 -07:00
Sergey Zubkov 01fa6a9bcf R.31 mark Example as Example, bad (closes #1651) 2020-07-29 12:37:42 -04:00
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>
2020-07-29 12:37:01 -04:00
cadenzasong d4e2281a09
removed extra space in an example in CP.2 (#1654) 2020-07-26 14:23:33 -04:00
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…
2020-07-25 15:00:05 -07:00
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)
2020-07-23 17:24:42 -07:00
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).
2020-07-23 14:41:33 -07:00
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.
2020-07-14 11:41:23 -04:00
hsutter 12f29f2ea9 Closes #1647 2020-07-09 12:00:47 -07:00
Sergey Zubkov 895d709546 NR.5: note that example is incomplete (closes #1643) 2020-07-09 14:24:22 -04:00
al-mission-2016 c6262ea1a8
+= structured bindings mentioning; -= '\n' (#1646)
It worth to mention the *structured bindings* right in the *Reason* section.
2020-07-09 11:04:17 -07:00
Sergey Zubkov 72fba35f33 travis CI fix 2020-07-09 13:08:55 -04:00
hsutter 43bbde7fc9 Committing PR #1640 to main branch 2020-07-03 17:43:13 -07:00
Sergey Zubkov ac7079b012 travis CI fix 2020-07-02 15:15:05 -04:00
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.
2020-07-02 11:08:50 -07:00
Arthur O'Dwyer c379d3f6ea
Remove a broken example, and copyedit. (#1637)
Using `this` in a free function makes the program ill-formed;
it doesn't magically give you a `std::thread*`.
2020-07-02 11:07:46 -07:00
Sergey Zubkov 45ad5c4628 C.49: fix typo in example (closes #1642) 2020-06-29 14:17:02 -04:00
Manlio Morini 2477f275dc
Fixed broken link (Res-nonnegative) (#1641) 2020-06-22 13:49:20 -04:00
Sergey Zubkov 8b94f6ee58 I.9: update outdated note that talks of 2018 as the future, closes #1525 2020-06-11 14:39:28 -04:00
Sergey Zubkov 62be4c856d ES.28: drop broken and unnecessary example, closes #1590 2020-06-11 14:35:31 -04:00
Anthony Cassidy 9efcaf07f7
Removed anti-CamelCase comments. (#1632)
The comments were:
// ???Must we suffer CaMelcAse???
and
// ugly CaMeLcAsEvArIaBlE
2020-06-04 11:19:47 -07:00
xtofl 4867a5c2d3
Use '<thing> template' i.s.o. 'template <thing>' (#1631)
* Use '<thing> template' i.s.o. 'template <thing>'

The word 'template' is often wrongly used as an adjective to the 'thing'
it becomes when instantiated.

* Expand succinct formulation for readability

Co-authored-by: Kristoffel Pirard <kristoffel.pirard@vanhool.com>
2020-06-04 11:18:37 -07:00
rico-chet 1936cb6b44
[NL.{11,15}] Bring rules in order (#1629)
The rules NL.11 (Make literals readable) and NL.15 (Use spaces
sparingly) are placed in inverted order in the text flow, swap them.
2020-06-02 15:23:14 -04:00
Sergey Zubkov 4625c984e9 bump date 2020-05-28 15:14:02 -04:00
Sergey Zubkov 24c3993e97 fix CI, fix heading and add comment requested at today's editor's call 2020-05-28 15:06:52 -04:00
Arthur O'Dwyer d56d67969c
Expand CP.61 to talk about the general "factory" pattern. (#1621) 2020-05-28 15:04:34 -04:00
Arthur O'Dwyer e8e0d103c0
CP.1: Simplify example, show good example, expand on rationale (#1615)
"Make your code thread-safe" usually means "don't use global state."
Advice to replace global state with `thread_local` state is usually misguided.
https://quuxplusone.github.io/blog/2018/11/14/fiber-local-storage/
2020-05-28 11:57:18 -07:00
Hyuk Myeong 19f2672b9e
Adjust the spacing for consistency (#1626)
* Adjust the spacing for consistency

* Adjust the spacing for consistency-2
2020-05-28 11:41:32 -07:00
rico-chet 9960c7dd7f
[SF.10] Fix annotation of the _bad_ example (#1627)
The _bad_ example wasn't annotated as such and a perfectly fine function
name was marked bad.

Annotate the example as bad and remove the misleading function name
annotation.
2020-05-28 11:37:50 -07:00
Moritz 'Morty' Strübe f604a6b5d6
[F.36] Typo (missing s) (#1623) 2020-05-20 11:34:11 -04:00
Arthur O'Dwyer 6e0f8ace0b
Tweak one of ES.10's examples for verisimilitude. (#1611)
For some reason the trailing `e = 3` seemed more of a red flag
than anything else about this line. Let's imply that the programmer
is trying to make some constants for hexadecimal translation.
2020-05-14 11:43:48 -07:00
Dale Visser 46dadd0b16
Modified slightly impolite language (#1601)
* dumb -> inefficient
2020-05-07 11:28:14 -07:00
Yaro Shkvorets 97797870ad
code typo in R.20 (#1619) 2020-05-06 08:41:10 -04:00