There is always something to try out when writing c programs. Sometimes you just want to know if a small piece of code works as expected without having to recompile the whole project. I used to write small programs for this, just like
But the more you program c, the more pieces of code you possibly want to try out. And writing all that wrapping stuff around the snippet you actually want to check isn't really productive. Therefore I came to the idea of a small program which would straight forward compile and run a piece of c code.
The tool works from the command line accepting the first parameter as a c code. The handy part here is that you don't have to create a c file, write that wrapping "main" stuff and so on. Just write an oneliner into the shell and get it compiled and ran. Here is the tool code
The example from above would be then evaluated like this
user@host:~> cpy 'printf("%c\n", 126);'
This way I'm not wasting my time anymore when I want to just evaluate a small snipet
The tool was written as just a small help and not wery much time was invested in it. As an improvement some frequently used headers, libs or some additional compiler or script params could be added. It'd even run on windows with VS i think. I'd appreciate if you'd post your additions or thoughts about this quick approach.
That's it, enjoy one more reason for not to waste your time