5 ms·
I don't know if it has a REPL, but it sure does look interesting, too: http://root.cern.ch/drupal/content/cint http://root.cern.ch/drupal/content/cint (also r
by factorizer 15y ago
I don't know if it has a REPL, but it sure does look interesting, too:
http://root.cern.ch/drupal/content/cint http://root.cern.ch/drupal/content/cint
(also root, of course)
- dazmax 15y agoIt does. I use it to check quick c questions. It works kind of like gdb's 'p' command, but you can also execute c code by putting it in braces. Here's an excerpt from my most recent cint repl session: cint> {long x = 84bfaad645e2e33f; double * p = &x;} Warning: Illegal numerical expression 84bfaad645e2e33f FILE:(tmpfile) LINE:1 cint> {long x = 0x84bfaad645e2e33f; double * p = &x;} cint> p p (double*)0x100809480 cint> p *p (double)(-8.31870270613823687e-286)
- wbhart 15y agoUnfortunately it is as slow as a dog. I'm not sure I understand what the pressing need for a C interpreter that is slow is. If so, there are two of them out there, including cint. The fact is, there is absolutely no technological reason why a C interpreter has to much slower than compiled C. Even the most stupid, naive implementation you can come up with is still as fast as Python (I know because I tried this last year). And with a proper Jit, it is absolutely possible to make it almost the same speed as compiled C.
- malkia 15y agoThe idea behind it, is to compile everything that you don't work right now, and interpret just what you are actually working. At the end of the day you can run the whole code compiled. Also you lose certain features that are available to the interpretter - but that's okay - that was the point...
- kaitanie 15y agoCINT is the closest thing I've ever seen to a real C++ REPL. It's actually used quite extensively in the ROOT data analysis environment (REPL, reflection, UI signal/slot mechanism, object persistency, creating dynamically Python bindings, etc.). As a REPL CINT actually works surprisingly well. Unfortunately it seems to have some problems interpreting certain "advanced" C++ stuff, such as templates and especially code that uses STL heavily. Another problem with it is that since you still need to manage memory manually and have direct access to pointers it's very easy to make CINT (or ROOT) session crash... :( Btw, the ROOT developers are also working on a new LLVM based C++ interpreter called Cling: http://root.cern.ch/drupal/category/package-context/cling http://root.cern.ch/drupal/category/package-context/cling
- wbhart 15y agoThanks for pointing out cling. Unfortunately they don't say which version of Clang/LLVM they build against. Their patches only seem to apply cleanly to version 2.8. But unfortunately it doesn't build for me. I also tried building it against 2.7 and 2.9 for good measure, but no cigar.
- wbhart 15y agoI got it to work. You have to build against the latest svn of clang and llvm. I personally found parallel make didn't work for me and that I had to apply the two very small patches to the makefiles manually, though the latter may be fixed by now. It looks like a really excellent project, and I can't wait until they have it working the way they want it to!