cppcheck Questions

4

Solved

I would like to use Cppcheck for static code analysis of my C++ code. I learned that I can suppress some kind of warnings with --inline-suppr command. However, I can't find what "suppressed_error_...
Nicety asked 2/6, 2010 at 9:17

3

When Cppcheck runs over this code,[1] it complains about an error: void bool_express(bool aPre, bool aX, bool aPost) { bool x; const bool pre = aPre; if (pre) { x = aX; } const bool post = a...
Termitarium asked 8/8, 2016 at 13:3

2

Solved

Cppcheck scans all files in a project folder: c:\projectfolder\main.c c:\projectfolder\file.c c:\projectfolder\file.h c:\projectfolder\file_test.cc c:\projectfolder\file_test.cc contains the fol...
Radarscope asked 27/11, 2012 at 19:35

1

Solved

I'm using Cppcheck to manage my code. I have the following function: bool my_function(std::string my_string) const { return 0 == my_string.compare("Some text"); // line 3 } To my surprise, I ge...
Corpuz asked 14/6, 2016 at 15:28

1

Solved

Example code: class Foo { // cppcheck-suppress noExplicitConstructor Foo(int foo) { } } Cppcheck call: $ cppcheck.exe --enable=all foo.cpp Checking foo.cpp... [foo.cpp:3]: (style) Class 'Foo'...
Dichromatism asked 8/6, 2016 at 11:23

2

Solved

I created a custom type, and put it into command.h typedef struct { char name[16]; int paramv[7]; int paramc; } command; I'm using it in many other files, but not in command.*. Now I ran the...
Guarded asked 24/4, 2016 at 16:34

3

Solved

I am using cppcheck for static analysis of C Code, but cannot seem to get an XML. I require the XML File to be consumed by Jenkins Here is what i have tried so far: runcppcheck.sh #!/bin/sh cd o...
Wallachia asked 16/5, 2012 at 1:51

1

Solved

Recently cppcheck raised an error in some C code, that has the structure: ((void)(value_prev = value), value = new_value()) In most cases this can be split onto 2 lines, however there are some c...
Sixtynine asked 30/4, 2016 at 2:15

1

During a code review, i found source code like this: void f_odd(std::string &className, std::string &testName) { if (className.find("::") != std::string::npos) { testName = className.su...
Acquire asked 27/4, 2016 at 12:10

1

Solved

When I used the (recently released) Cppcheck 1.69 on my code1, it showed a whole lot of messages where I expected none. Disabling noExplicitConstructor proved that all of them were of exactly this ...
Salver asked 5/5, 2015 at 11:58

1

Solved

This cppcheck --enable=style --inconclusive --check-config --xml --xml-version=2 -v -I.. -I../mocks -I../gmock -I../gtest -DUNIT_TEST ../src results in this <?xml version="1.0" encoding="UT...
Admirable asked 19/10, 2015 at 15:22

2

Solved

I'm trying to get a random number in C++ and I'm using rand(). This is what cpplint says: Consider using rand_r(...) instead of rand(...) for improved thread safety. I'm switching to rand_r an...
Temikatemp asked 19/3, 2015 at 0:26

1

Solved

The cpp-check error is: error mismatchAllocDealloc false Mismatching allocation and deallocation: val2 What should I do to fix this error? void MainWindow::ParseDemo(char *pBuf) { char* val2 = n...
Granado asked 4/9, 2015 at 9:41

1

Solved

Our team previously used Lint as a static code analyser, but it became too cluttered and had too much noise. We are using C++03 with frequent use of Boost, and Lint didn't seem to like Boost (I he...
Caretaker asked 23/7, 2015 at 4:29

1

Solved

I am using cppcheck for static analysis. To accelerate review process I want to set up cppcheck to look for some custom rules, for example to check if geter functions defined as a const. If anyone...
Abfarad asked 20/6, 2015 at 13:59

3

I ran cppcheck over some code to look for possible runtime errors. And it is reporting a possible null pointer dereference with the following situation: Foo* x = ... //defined somewhere ... Foo*...
Anaemia asked 17/12, 2010 at 20:5

3

Solved

I installed the Cppcheck tool for static code analysis of my C++ project and got the feeling that it performs poorly. For example, can anyone tell me why Cppcheck is unable to find an array out-of-...
Marianamariand asked 15/8, 2012 at 9:4

2

Solved

i am just using cppcheck the code is working properly just cppcheck gives this errors. void WorkerThread(WorkBuffer* m_buffer) { std::cout << "Thread : " << m_buffer->m_id <<...
Sicklebill asked 20/4, 2015 at 14:20

2

Solved

I use realloc to resize the memory allocated: char **get_channel_name(void) { char **result; int n; result = (char **) 0; for (elem = snd_mixer_first_elem(handle), n = 0; elem; elem = snd_mi...
Boz asked 21/12, 2014 at 13:33

1

Solved

CppCheck 1.67 has identified and array accessed out of bounds error on one of my projects. I didn't think the code was wrong, so I have stripped down the code to the bare minimum example that still...

1

Solved

Consider writing implementation for some not-so-obvious algorithm in C. For example let it be recursive quicksort, that I have found in K. N. King's "C Programming: A Modern Approach, 2nd Edition" ...
Unhand asked 18/6, 2014 at 11:25

3

CppCheck finds me some findings like: "The scope of the variable 'x' can be reduced". What if I have this situation: int x; for (int i = 0; i != 10; ++i) { x = someFunction(); // ... I use x v...
Shaunta asked 12/5, 2014 at 8:52

2

Solved

Cppcheck report as an error "Mismatching allocation and deallocation: cname" for the line with delete cname;. I don't see what the problem with using my version of code is - it looks working. Is m...
Permeate asked 1/2, 2014 at 16:21

2

Solved

cppcheck can't find even standard headers such as iostream. Any ideas? I am using Ubuntu 11.04 and cppcheck from the repository.
Acoustics asked 8/8, 2011 at 17:26

1

I have an extreme problem. I have been working on a game for about two years(20000+ lines of code), and Lately I have been noticing a ton of memory leaks. The problem is that I cannot track every ...
Attestation asked 13/1, 2013 at 22:59

© 2022 - 2024 — McMap. All rights reserved.