Commit Graph

66 Commits

Author SHA1 Message Date
Daniel Marjamäki c130208d9d Manual: fixes 2019-06-02 11:28:50 +02:00
Paul Fultz II 091f4bcf8d Add check for unnecessary search before insertion
This will warn for cases where searching in an associative container happens before insertion, like this:

```cpp
void f1(std::set<unsigned>& s, unsigned x) {
    if (s.find(x) == s.end()) {
        s.insert(x);
    }
}

void f2(std::map<unsigned, unsigned>& m, unsigned x) {
    if (m.find(x) == m.end()) {
        m.emplace(x, 1);
    } else {
        m[x] = 1;
    }
}
```

In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.

I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
Daniel Marjamäki 1f68e038be Addons: Describe running addons from cppcheck in the manual 2019-04-08 21:31:38 +02:00
Sebastian b62a7fe059 manual.md: Spelling fixes (#1791)
Thanks!
2019-04-08 16:03:43 +02:00
Sebastian d8d4ca51d7
manual.md: Fix markdown lint warnings. (#1773) 2019-04-03 20:05:04 +02:00
versat 5fb23a4983 manual.md: Fix wrong code indentation. 2019-04-01 13:30:24 +02:00
versat 1c24a14f3f manual.md: Fixed missing back ticks and spaces.
When not between back ticks everything between angle brackets is
interpreted as HTML tags and not rendered.
Also fixed missing spaces after a sentence and in a code block.
2019-04-01 09:29:05 +02:00
Daniel Marjamäki 475036c4bc manual.md: describe library configuration 2019-03-17 10:28:53 +01:00
Daniel Marjamäki 5461fb64e3 manual.md: replace __MSCVER with _MSC_VER, that is more correct 2019-03-11 18:21:17 +01:00
Daniel Marjamäki 7fd34ac8a2 Manual: Add chapter about speeding up Cppcheck analysis 2019-03-11 13:11:17 +01:00
Daniel Marjamäki 996916358a manual.md: minor tweaks 2019-03-04 20:44:57 +01:00
Daniel Marjamäki f77754ba3b manual.md: Improved 'Get started' chapter. Add 'HTML Report' chapter 2019-03-04 20:33:13 +01:00
versat 973ccda733 manual.md: Copy and adapt chapter "Using your own custom .cfg file". 2019-03-04 16:11:42 +01:00
Daniel Marjamäki 97dc19b9b1 manual.md: imported info from manual.docbook 2019-03-03 17:31:02 +01:00
Daniel Marjamäki 5e85a3df6c manual.md: Add a 'Getting started' chapter 2019-03-02 14:33:14 +01:00
Daniel Marjamäki caaa4c0b98 manual.md: Add new manual file. 2019-03-02 10:08:09 +01:00