Commit Graph

1894 Commits (fae4ed3768ec6361a71caba7667360ed115abc15)
 

Author SHA1 Message Date
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 5 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
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*`.
6 years ago
Sergey Zubkov 45ad5c4628 C.49: fix typo in example (closes #1642) 6 years ago
Manlio Morini 2477f275dc
Fixed broken link (Res-nonnegative) (#1641) 6 years ago
Sergey Zubkov 8b94f6ee58 I.9: update outdated note that talks of 2018 as the future, closes #1525 6 years ago
Sergey Zubkov 62be4c856d ES.28: drop broken and unnecessary example, closes #1590 6 years ago
Anthony Cassidy 9efcaf07f7
Removed anti-CamelCase comments. (#1632)
The comments were:
// ???Must we suffer CaMelcAse???
and
// ugly CaMeLcAsEvArIaBlE
6 years ago
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>
6 years ago
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.
6 years ago
Sergey Zubkov 4625c984e9 bump date 6 years ago
Sergey Zubkov 24c3993e97 fix CI, fix heading and add comment requested at today's editor's call 6 years ago
Arthur O'Dwyer d56d67969c
Expand CP.61 to talk about the general "factory" pattern. (#1621) 6 years ago
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/
6 years ago
Hyuk Myeong 19f2672b9e
Adjust the spacing for consistency (#1626)
* Adjust the spacing for consistency

* Adjust the spacing for consistency-2
6 years ago
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.
6 years ago
Moritz 'Morty' Strübe f604a6b5d6
[F.36] Typo (missing s) (#1623) 6 years ago
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.
6 years ago
Dale Visser 46dadd0b16
Modified slightly impolite language (#1601)
* dumb -> inefficient
6 years ago
Yaro Shkvorets 97797870ad
code typo in R.20 (#1619) 6 years ago
apenn-msft f4c80921d6
Update CppCoreGuidelines.md 6 years ago
apenn-msft 4e61010c27
keep wording more consistent
.... if a bit more monotonous, but that's ok.
6 years ago
apenn-msft 426ac8747d
updated wording around use of <> for projects
make it more clear that using <> for external projects is just a typical example (and not the only use case for <> outside of standard headers)
6 years ago
apenn-msft bbc2f4dc5d
Merge branch 'master' into patch-1 6 years ago
Sergey Zubkov 986402298a travis CI fixes 6 years ago
Arthur O'Dwyer d45496ff5e
You should never =delete a destructor! (#1605) 6 years ago
apenn-msft 30ef5b8524
update code markdown for #include 6 years ago
apenn-msft 66792e4875
Update wording and examples for SF.12: Prefer the quoted form of `#include` for files relative
Updated wording, adjusted example, and provided a more verbose example of what can go wrong if using the wrong form.
6 years ago
apenn-msft e47463c14a
SF.12: Prefer the quoted form of `#include` for files relative to the including file
The current guidance on SF.12 can be over-applied and devolves into "always use <>" because all compilers support adding include directories to the <> search. In this case, even the current directory may be added and so it is always possible to use <> for every header. Applying the guidance then devolves into an undesirable state where <> is always used and include"" is never used.

Instead, the proposed guidance leverages and encourages the distinction between <> and "" to create an easy-to-understand rule that the original guidance hints at and that most developers already follow and understand: "" is for local headers and <> is for library and external headers.
6 years ago