我在哪里可以找到好的 C++ 源代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/818647/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 17:25:09  来源:igfitidea点击:

Where can I find good C++ source code?

c++

提问by jkeys

I am learning C++ as a first language. I feel like I am about to hit a ceiling on my learning (I am not learning through a class) if I don't start looking at actual code soon. Here are my two main questions:

我正在学习 C++ 作为第一语言。如果我不尽快开始查看实际代码,我觉得我的学习即将达到上限(我不是通过课堂学习)。这是我的两个主要问题:

  1. Where can I find source code
  2. What is a good litmus test on code's quality (I've obviously never developed in a work environment)
  1. 我在哪里可以找到源代码
  2. 什么是代码质量的良好试金石(我显然从未在工作环境中开发过)

I hope this is relevant to SO, but I can see the need to close this. Thanks for the help.

我希望这与 SO 相关,但我可以看到需要关闭它。谢谢您的帮助。



Related:

有关的:

Examples of "modern C++" in action?

“现代 C++”的例子?

采纳答案by Mike Ottum

I would recommend Boost. Using Boost will simplify your program design. Reading Boost source code can show you how to use C++ to solve some challenging problems in a concise way.

我会推荐Boost。使用 Boost 将简化您的程序设计。阅读 Boost 源代码可以向你展示如何使用 C++ 以简洁的方式解决一些具有挑战性的问题。

This add on library is itself written in C++, in a peer-reviewed fashion, and has a high standard of quality.

这个附加库本身是用 C++ 编写的,采用同行评审的方式,具有高标准的质量。

回答by JaredPar

I think your two best bets for finding C++ code are to go to the popuplar open source repositories.

我认为寻找 C++ 代码的两个最佳选择是去流行的开源存储库。

These all have high quality C++ projects you can take a look at. I don't think there's a great metric for judging quality on a large scale. I would start with the more popular projects which may be more likely to have quality code.

这些都有高质量的 C++ 项目,你可以看看。我不认为有一个很好的衡量标准来大规模地判断质量。我将从更受欢迎的项目开始,这些项目可能更有可能拥有高质量的代码。

回答by JerSchneid

I would recommend getting a good book, which will be packed full of source code examples!

我建议你买一本好书,里面装满了源代码示例!

C++ in a Nutshell

简而言之 C++

You can also search open source code at www.koders.com

您也可以在www.koders.com 上搜索开源代码

回答by Alex Martelli

The net is chock-full of open-source C++ code. Why not pick a few such projects, and, even better, start helping out of them? No better way of learning than by doing!

网络上充满了开源 C++ 代码。为什么不选择一些这样的项目,甚至更好地开始帮助他们呢?没有比实践更好的学习方式了!

回答by Chris

I think you got some good answers already, I would like to add this suggestions for picking a project from one of the open source project repositories: Pick a widely used but preferably smaller project that has been around for a while and targets a domain that you are specifically interested in. That way you will be able to get a better idea of production ready code and be able to learn something about that domain.

我认为您已经得到了一些很好的答案,我想添加以下建议,以便从其中一个开源项目存储库中选择一个项目:选择一个广泛使用但最好是较小的项目,该项目已经存在一段时间并针对您的域是特别感兴趣的。通过这种方式,您将能够更好地了解生产就绪代码,并能够了解有关该领域的知识。

回答by Mark Essel

The List:

列表:

回答by t.g.

I found the source code and documentation of POCOare quite readable, and

我发现POCO的源代码和文档非常易读,而且

  1. unlike some other open source projects that focus on handling one specific problem, say GUI or Logging, this library focuses on developing a complete application, thus covering a quite broad area(file system, text processing, networking, logging etc ).
  2. it uses modern C++ idioms. So by reading the implementation you can learn modern C++ skills as well.
  1. 不像其他一些专注于处理一个特定问题的开源项目,比如 GUI 或日志记录,这个库专注于开发一个完整的应用程序,因此涵盖了相当广泛的领域(文件系统、文本处理、网络、日志记录等)。
  2. 它使用现代 C++ 习语。因此,通过阅读实现,您也可以学习现代 C++ 技能。

回答by AndreasT

I would recommend OpenSG It is an interesting topic, it uses concurrency modeling, networking, includes links to scientific papers, is well documented, uses real c++ not c with objects stuff and almost all subparadigms and doesn't overuse them, is easily accessible AND who would have guessed... I am a fan of it ;)

我会推荐 OpenSG 这是一个有趣的话题,它使用并发建模,网络,包括科学论文的链接,有据可查,使用真正的 c++ 而不是 c 与对象和几乎所有子范式,并且不会过度使用它们,易于访问并且谁会猜到......我是它的粉丝;)

OpenSG - Home

OpenSG - 主页

回答by Michael Haephrati

Code Projectis the best place for source code.

Code Project是源代码最好的地方。

回答by SingleNegationElimination

C++ is a great language, but kind of heavy as a first language. Try python.

C++ 是一种很棒的语言,但作为第一语言有点沉重。试试蟒蛇

1) Where can I find source code

1)我在哪里可以找到源代码

Reading code is harder than writing it. This is especially true of large, complex languages like C++. Without already knowing the intricacies of the language, you don't stand much chance of getting knowledge from the complex code others write in production. You're going to have to learn the very smallest parts first, on your own by writing it. As you learn c++, you will also learn programming.

阅读代码比编写代码更难。对于像 C++ 这样的大型复杂语言尤其如此。在不了解该语言的复杂性的情况下,您很难从其他人在生产中编写的复杂代码中获得知识。您将必须首先通过编写自己的方式学习最小的部分。在学习 C++ 的同时,您还将学习编程。

2) What is a good litmus test on code's quality

2)什么是代码质量的良好试金石

There isn't one. That's not going to be an easy thing to learn, either. It comes from experience. But really, the way you know the good code from the bad, is that after you've had some time to familiarize yourself with the layout of a project, you can understand what any given piece does, after you look at it. Readable code has quality, whereas confusing code falls short.

没有一个。这也不会是一件容易学习的事情。它来自经验。但实际上,区分好代码和坏代码的方式是,在您花一些时间熟悉项目的布局之后,您可以在查看任何给定部分后了解它的作用。可读的代码有质量,而混乱的代码则不够。

Looking at other peoples code is a hard way to learn the basics. Find a tutorialon the net and get your feet wet that way. I'm sure there are many, fine printed bookson the subject as well.

查看其他人的代码是学习基础知识的一种艰难方式。在网上找到一个教程,然后用这种方式弄湿你的脚。我相信还有很多关于这个主题的印刷精美的书籍

As you go, and get stuck or confused or lost, post questions here.

在您前进时,遇到卡住、困惑或迷路的情况,请在此处发布问题。