3 ms·
> then you'll really wish that you had a REPL Yes. I write roughly equal amounts of C (microcontroller firmware) and Python (overall system control, running on
by photojosh 9y ago
> then you'll really wish that you had a REPL
Yes. I write roughly equal amounts of C (microcontroller firmware) and Python (overall system control, running on embedded Linux).
I absolutely wish I had a REPL for C. When implementing with a new library in Python, I'll usually use iPython to explore it, and if I need to run a decent amount of data through, I'll use a Jupyter notebook. I'd put the difficulty of grokking a C library somewhere between 10x and 100x harder.
- yorwba 9y agoI use gdb as a C REPL. You attach it to a binary that has the functions you need, then you can use them with the `p` (or `print`) command. Loops and new function definitions are not possible, but sometimes it's still good enough.
- pjmlp 9y agoThat is how I once developed a B+ Tree library for low level disk blocks back in 1996, it was quite helpful tracking down how the nodes were being used.
- RhysU 9y agoGdb as REPL is a nice trick. Beaker Notebook might give the notebook parent wants for C work.
- photojosh 9y agoThanks. It won't since all my C work is embedded and mainly systems programming rather than algorithms. But I'll keep it in mind for the next time I have to translate my Python explorations over to C for production.
- photojosh 9y agoGood point. I've only been working with AVRs for a few years since I've been at this job, but looks like it might be doable. Thanks for the tip.
- pjmlp 9y agoC has had REPLs since the 90's, one just needs to search for them, and eventually buy them. They were quite common advertising in The C User's Journal and Dr. Dobbs.