Comments (3)
The parameters to a swap
function are in-out parameters, not out parameters. So F.17 applies, not F.20.
The enforcement for F.20 says to flag non-const reference parameters that are not read before being written to (because that implies they are out parameters, not in-out parameters). That enforcement won't trigger for a conventional swap
because you have to read them before writing to them.
What's the concrete problem here?
from cppcoreguidelines.
Mayben then the problem is that static code analysis tools detect this in a wrong way, or this is not well understand.
from cppcoreguidelines.
I still don't understand what the actual issue is.
Are you getting diagnostics from some tool? Which tool? For which code? What does the diagnostic say?
So far there is nothing actionable here.
from cppcoreguidelines.
Related Issues (20)
- R.3: raw pointer
- I.2: Avoid non-const global variables
- E.16 not noexcept copy constructor
- ES.30: Don’t use macros for program text manipulation HOT 3
- [Proposal] Allow pointer parameters to coroutines (CP.coro section)
- SL.con.1: Prefer using STL array or vector instead of a C array HOT 3
- Chem
- File extensions for modules? HOT 2
- ES.30: Don’t use macros for program text manipulation - example warnings HOT 3
- tyu
- Create binary tree by array HOT 1
- ES.25 -- Is it truly beneficial to always employ const for objects? HOT 2
- Ranges require exception to F.19 HOT 7
- Wrong links in P.8 HOT 1
- Halo HOT 1
- Remove enforcement rules of rule F.17 HOT 7
- ES.79 is a terrible advice and should be dropped HOT 14
- C.21 Exception for copy-and-swap idiom HOT 4
- Broken links HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppcoreguidelines.