What open source C++ static analysis tools are available?

Java has some very good open source static analysis tools such as FindBugs, Checkstyle and PMD. Those tools are easy to use, very helpful, runs on multiple operating systems and free. Commercial C++ static analysis products are available from vendors Klocwork, Gimpel and Coverity. Also there is less-known PVS-Studio analyzer. Although having such products are great, the cost is just way too

什么开源C ++静态分析工具可用?

Java有一些非常好的开源静态分析工具,例如FindBugs,Checkstyle和PMD。 这些工具易于使用,非常有用,可在多个操作系统上运行并免费使用。 商业C ++静态分析产品可从供应商Klocwork,Gimpel和Coverity获得。 还有一些鲜为人知的PVS-Studio分析仪。 虽然有这样的产品很好,但对学生来说成本太高了,通常很难获得试用版本。 另一种方法是找到可在多种平台(Windows和Unix)上运行的开源C ++静态分析工具。 通过使用开源工

Learning C++ Language

I am a .net c# programmer but I want to learn .NET C++ also. I am a beginner for c++. Is there any site, book, or Video Tutorials from beginner to expert? There's no such thing as ".Net c++". Maybe you mean C++/CLI , which is Microsoft's language specification intended to supersede Managed Extensions for C++ (See Wikipedia). Managed extensions to C++ are its inferior and

学习C ++语言

我是.net c#程序员,但我也想学习.NET C ++。 我是c ++的初学者。 是否有任何网站,书籍或视频教程从初学者到专家? 没有“.Net c ++”这样的东西。 也许你的意思是C ++ / CLI ,这是Microsoft的语言规范,旨在取代托管扩展C ++(请参阅Wikipedia)。 对C ++的托管扩展是其低劣的现在已经不存在的祖先[感谢@dp的评论]。 记住,当你选择你的学习资料时,C ++ / CLI不等于(标准) C ++编程语言; 所以如果你想学习前者,

Is modern C++ becoming more prevalent?

When I first learned C++ 6-7 years ago, what I learned was basically "C with Classes". std::vector was definitely an advanced topic, something you could learn about if you really wanted to. And there was certainly no one telling me that destructors could be harnessed to help manage memory. Today, everywhere I look I see RAII and SFINAE and STL and Boost and, well, Modern C++. Even p

现代C ++变得更流行了吗?

当我6-7年前第一次学习C ++时,我所学到的基本上是“C with Classes”。 std::vector绝对是一个高级话题,如果你真的想,你可以学习一些东西。 当然没有人告诉我可以利用破坏者来帮助管理记忆。 今天,在我看来,我看到了RAII和SFINAE,STL和Boost,以及现代C ++。 即使刚刚开始使用该语言的人似乎也从第1天开始就教授这些概念。 我的问题是,这仅仅是因为我只看到了“最好的”,也就是这里提到的关于SO的问题,以及其他倾向于

member (" : ") syntax in the constructor?

Recently I've seen an example like the following: #include <iostream> class Foo { public: int bar; Foo(int num): bar(num) {}; }; int main(void) { std::cout << Foo(42).bar << std::endl; return 0; } What does this strange : bar(num) mean? It somehow seems to initialize the member variable but I've never seen this syntax before. It looks like a function/constr

member(“:”)语法在构造函数中?

最近我看到一个例子如下: #include <iostream> class Foo { public: int bar; Foo(int num): bar(num) {}; }; int main(void) { std::cout << Foo(42).bar << std::endl; return 0; } 这有什么奇怪的: bar(num)是什么意思? 它似乎初始化成员变量,但我从来没有见过这种语法。 它看起来像一个函数/构造函数调用,但为int ? 对我来说毫无意义。 也许有人可以启发我。 顺便说一下,是否还有

How does a language expand itself?

I am learning C++ and I've just started learning about some of Qt's capabilities to code GUI programs. I asked myself the following question: How does C++, which previously had no syntax capable of asking the OS for a window or a way to communicate through networks (with APIs which I don't completely understand either, I admit) suddenly get such capabilities through libraries writt

语言如何扩展自己?

我正在学习C ++,并且刚刚开始学习Qt编写GUI程序的一些功能。 我问自己以下问题: 我以前没有语法能够向操作系统请求窗口或通过网络进行通信的方式(我承认我还没有完全理解的API)的C ++如何通过使用C ++自己编写的库突然获得此类功能? 这一切似乎对我来说非常循环。 你可能会在这些库中提供哪些C ++指令? 我意识到这个问题对于一个有经验的软件开发人员来说似乎微不足道,但我一直在研究几个小时而没有找到任何直接的

Fast integer matrix multiplication with bit

I am asking if it is possible to improve considerably integer matrix multiplication with bitwise operations. The matrices are small, and the elements are small nonnegative integers (small means at most 20). To keep us focused, let's be extremely specific, and say that I have two 3x3 matrices, with integer entries 0<=x<15. The following naive C++ implementation executed a million ti

用位快速整数矩阵乘法

我在问是否有可能通过按位运算来改善相当大的整数矩阵乘法。 矩阵很小,元素是小的非负整数(小的意思是最多20个)。 为了保持我们的专注,让我们非常具体,并说我有两个3x3矩阵,整数条目0 <= x <15。 以下天真的C ++实现执行了一百万次,执行时间大约为1s,用linux time测量。 #include <random> int main() { //Random number generator std::random_device rd; std::mt19937 eng(rd()); std::uniform_int_

Is Big Oh the only notation used to measure complexity in STL

I have started reading C++ STL and also found a book for that!. while i was reading the complexity,which plays major role in choosing algorithms and data structures i have been seeing that the Big Oh notation was only used with different variables(O(n),O(log(n).,) and by further surfing i found the Big Oh denotes f(x) = O(g(x))--(big-oh) means that the growth rate of f(x) is asymptotically less

Big Oh是衡量STL复杂性的唯一符号

我已经开始阅读C ++ STL,并为此找到了一本书! 当我读到复杂性时,它在选择算法和数据结构中起主要作用,我已经看到Big Oh表示法只用于不同的变量(O(n),O(log(n)。),并且进一步冲浪我发现Big Oh表示f(x) = O(g(x))--(big-oh) means that the growth rate of f(x) is asymptotically less than or equal to to the growth rate of g(x) 所以我的问题是,如果一个算法的时间复杂度总是等于g(x)的增长,为什么我们将

Cycles in family tree software

I am the developer of some family tree software (written in C++ and Qt). I had no problems until one of my customers mailed me a bug report. The problem is that the customer has two children with their own daughter, and, as a result, he can't use my software because of errors. Those errors are the result of my various assertions and invariants about the family graph being processed (for e

家庭树软件中的循环

我是一些家族树软件(用C ++和Qt编写)的开发人员。 直到我的一位客户邮寄给我一份错误报告,我才有了问题。 问题在于客户有两个孩子和他们自己的女儿,结果,他因为错误而无法使用我的软件。 这些错误是我关于正在处理的家庭图的各种断言和不变量的结果(例如,在步行一个循环后,程序指出X不能既是父亲也是Y的祖父)。 如何在不删除所有数据断言的情况下解决这些错误? 看来你(和/或你的公司)对家庭树应该是什么有一

suffix tree construction

i am going to implement suffix tree for given string, i think it should delcared like this struct suffix { char letter; suffix * left,*right; }; suffix *insert(suffix *node,char *s){ } //here i am going to construct tree with all occurances of substrings and characters but dont know how use left and right part,is this tree sorted and arranged by strict ordering of characters like binary se

后缀树的建设

我将为给定的字符串实现后缀树,我认为它应该像这样去除 struct suffix { char letter; suffix * left,*right; }; suffix *insert(suffix *node,char *s){ } //这里我要构造出所有子字符串和字符的树,但不知道如何使用左右部分,这棵树是按照二叉搜索树的字符严格排序排序和排列的吗?或者?请帮助我,我不会想要在网上使用一些代码,我需要自己实现它,所以请给我一些提示,一些小代码 维基百科是一个开始。 然而实

Suffix tree of large (10Mb) text taking excessive memory

I implemented (see code below) the absolute minimal generalized suffix tree building algorithm. I wrote a unit test and it seems to work as expected (finds the right substring at the right position) . But the tree is impractically large. Question: Did I make a mistake somewhere, or are suffix trees in this basic form only usable for very short texts? Statistics I want to use this to search

大文本(10Mb)的后缀树占用过多的内存

我实现了(见下面的代码)绝对最小的通用后缀树构建算法。 我写了一个单元测试,它似乎按预期工作(在正确的位置找到正确的子字符串)。 但这棵树不切实际地大。 问题:我在某个地方犯了什么错误,或者这种基本形式的后缀树只能用于很短的文本吗? 统计 我想用它来搜索大量的文本:多个15-20Mb的文本文件,或者例如40'000个字符串〜每个60个字符。 当我建立40'000字符串2.5Mb后缀树(这是一个名单,如果公司名