Compiling with
-D_GLIBCXX_DEBUG
Helps to detect various bugs with iterators and other horrible stuff.
#!/bin/bash | |
# Based on http://algs4.cs.princeton.edu/linux/ | |
declare -r ALGS4_DIRECTORY=~/.local/algs4 | |
get_drjava() { | |
wget http://algs4.cs.princeton.edu/linux/drjava.jar | |
wget http://algs4.cs.princeton.edu/linux/drjava | |
chmod 700 drjava |
#!/bin/sh | |
# Usage: add this file to your project's .git/hooks directory. Rename it to | |
# just 'pre-commit' and make it executable. | |
# Now, when you change some files in repository and try to commit these | |
# changes, git will run this script right before commit. | |
# | |
# This script checks: | |
# C/C++ files with cppcheck | |
# XML files with xmllint |
#include <array> | |
#include <cassert> | |
#include <iostream> | |
#include <set> | |
#include <sys/ioctl.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <unistd.h> |
#include <stdio.h> | |
void f() | |
{ | |
char s[8] = ""; | |
snprintf(s, sizeof(s), "ip"); | |
} |
#include <iomanip> | |
#include <iostream> | |
#include <locale> | |
using namespace std; | |
int main () | |
{ | |
istream& work{cin}; | |
cout.imbue(locale("ru_RU.utf8")); |
#include <iostream> | |
#include <type_traits> | |
using std::cout; | |
struct Complex | |
{ | |
float real; | |
float imag; | |
}; |
int a; | |
void fn1(int = {}) { | |
for (int i; i < a;) | |
; | |
} |
$ tree | |
. | |
├── Cargo.lock | |
├── Cargo.toml | |
├── src | |
│ ├── foo | |
│ │ └── mod.rs | |
│ ├── lib.rs | |
│ └── main.rs | |
└── tests |
$ gdb $CPPCHECK | |
Reading symbols from /home/user/projects/cppcheck/cppcheck...done. | |
(gdb) r lib/SILGen/ArgumentSource.cpp | |
Starting program: /home/user/projects/cppcheck/cppcheck lib/SILGen/ArgumentSource.cpp | |
Checking lib/SILGen/ArgumentSource.cpp... | |
Program received signal SIGSEGV, Segmentation fault. | |
0x00000000009f2268 in valueFlowSwitchVariable (tokenlist=0x7fffffffbd10, symboldatabase=0xef6c80, errorLogger=0x7fffffffd010, settings=0x7fffffffd048) at lib/valueflow.cpp:2173 | |
2173 valueFlowForward(tok, vartok->variable()->scope()->classEnd, vartok->variable(), vartok->varId(), values, false, tokenlist, errorLogger, settings); | |
Missing separate debuginfos, use: dnf debuginfo-install libgcc-5.3.1-2.fc23.x86_64 libstdc++-5.3.1-2.fc23.x86_64 |