16

我正在寻找带有 REPL 的优秀 C++ IDE。视觉工作室中的那个不是......好吧,大多数时候如果我在源代码中复制/粘贴一行,REPL 会拒绝它,即使它是我放置断点或跳过的行。

C++ 有没有好的 IDE 或 REPL?

4

3 回答 3

18

紧贴

什么是紧贴?

Cling 是一个交互式 C++ 解释器,构建在 LLVM 和 Clang 库之上。与标准解释器相比,它的优势在于它具有命令行提示符并使用即时 (JIT) 编译器进行编译。这类软件应用程序的许多开发人员(例如 Mono 在他们的项目中称为 CSharpRepl)将它们命名为交互式编译器。

Cling 的主要目标之一是在 ROOT 项目 - CINT 中提供当前 C++ 解释器的现代、高性能替代方案。与 CINT 的向后兼容性是开发过程中的主要优先事项。

http://root.cern.ch/drupal/content/cling

于 2013-04-18T16:34:53.240 回答
9

CINT

什么是 CINT?

CINT 是 C 和 C++ 代码的解释器。例如,对于快速开发比执行时间更重要的情况,它很有用。使用解释器可以大大减少编译和链接周期,从而促进快速开发。CINT 使 C/C++ 编程变得愉快,即使是兼职程序员也是如此。

CINT 本身是用 C++ 编写的,代码行数略少于 400,000 行。它被银行、集成设备甚至游戏环境中的多家公司用于生产,当然还有ROOT,使其成为全球大量高能物理学家的默认解释器。

http://www.hanno.jp/gotom/Cint.html

于 2013-04-18T16:33:47.750 回答
2

CLing should be independant of Clang and abble to compile on any platform, recent works of CERN tend to separate Cling from Clang and it's good trends.

What I don't under is mostly the existence of Clipp in C++ allowing to parse javascript embedded in my C++ code and can't find a version of Clipp for just C++ / Boost / Eigen / Quantlib.

Another thing I don't understand is why TinyCC with a 200ko size is abble to parse windows.h without a problem and LLVM team complaining about Clang on windows.H detonate on tarmac.

All in all, with fusion, spirit, wave and the so many people wishing for a C++ REPL, why after 2 decade there is not even small version of it.

Here is my solutions

Forget about REPL C++ and stick to REPL C, use tinyCC and expose only the functionnal action of method by using pointer function A.function(toto t) -> function(A *, toto t). To make it works with object method you can also use declaration as struct __declspec(novtable) A { };

This will allow binary align compatibility between tinyCC struct understanding and your true object. True you will have to split the tuple of data and the tuple of method, but after all, that should have always be the case in first place. Object design should have split data and method into a dual model rather than a mixed model good for bug. In many case, the compiler will split the object into dual model anyway. This will provide extrem fast prototyping even for scientist and user of Cling/Cint.

Second solution, rather than REPL statement, use the dynamic load/unload pair, you setup a chain of compilation ( incremental build or not ) and auto relink compiled library when the source change. It isn't slow at all. This give the advantage to do it on any supported dynamic library OS and it's very EASY to do.

Third solution, the most easiest way, boot a linux based vm ( install llvm tool chain), and use Cling on the vm. That won't work in a firm full windowOSed but it seems LLVM are windows OS haters.

于 2014-04-30T14:28:28.967 回答