使用 python 编写守护进程而不是 C++

发布于 2024-11-18 19:45:08 字数 281 浏览 3 评论 0原文

我即将与一位朋友开始一个守护程序项目,他将进行设计,我将进行编码 我对 Python 和 C++ 感到困惑 我了解 C++,但如果我愿意的话,我需要学习 Python 我要写的守护进程实际上会不止1个守护进程,每个守护进程负责一个功能,例如接受来自网络的SSL连接,流音频和视频,发送文件和数据以及更多网络操作,我喜欢使用 C++,但我担心从那时起我将无法修复将发生的内存泄漏(肯定),但我也害怕使用 Python,因为我不知道我不知道它是否能完成这项工作对我来说有什么建议吗

I am about to start into a daemon project with a friend, he will do the design and I will do the coding
I am confused between Python and C++
I know C++, but I need to learn Python if I will go with it
The daemon I am about to write will be more than 1 daemon actually, each one is responsible for a function, such as accepting SSL connections from network, stream audio and video, sending files and data and more network operations, I like going with C++ but I am afraid from the time I'll lose fixing the memory leaks that will occur (for sure), but also I am afraid from Python because I don't know it and I don't know if it can do the job for me or not

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沉睡月亮 2024-11-25 19:45:08

使用正确的工具完成正确的工作。如果您想要一个持续运行很长时间的流程,您将需要证明其某些正确性(不是完整的,但至少是某些)。该证明由接受该语言的编译器或解释器提供给您。这在很大程度上取决于语言,以及您的程序已经证明了哪些内容。对于Python,你得到了语法正确性的证明,仅此而已。如果您使用 C++,所有方法的存在性和某些类型的健全性也将被证明。这对于长时间运行的进程(例如守护进程)来说要好得多。在某些语言中,您可以使用编译器来证明更多内容,但这通常并不那么简单。

不用太担心内存泄漏。正如评论中所指出的,如果您使用现代 C++,内存泄漏或内存损坏不再是问题,并且速度会比存在垃圾收集器高得多。使用 C++ 或 C++0x 但不要使用 C/C++,一切都会好起来的。

Use the right tool for the right job. If you want a process that keeps on running for a long time you will want a proof of some of it's correctness (not a complete one, but at least something). This proof is given to you by the compiler or interpreter accepting the language. It depends a lot on the language, what kind of things are proven about your program. For python you get a proof of syntactic correctness, that is all. If you use C++ existence of all methods and some type soundness will also be proven. This is much better for long running processes, such as daemon. There are languages, where you can use the compiler to prove even more, but this is often not as simple.

Don't worry too much about the memory leaks. As has been pointed out in the comments, if you use modern C++ memory leaks or memory corruption are not an issue anymore and speed will be much higher, than if a garbage collector is present. Use C++ or C++0x but not C/C++, and all will be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文