Question

I picked up a copy of tiny c compiler (TCC) so i can do some c programming at work. Unfortunately, a new network security policy prohibits non-IT personnel from downloading/saving exe files. Of course, each time I try to complile helloworld.c the boss gets notified that I'm a malicious haxor...

My question -- is some sort of c interpreter or environment that i can practice c programming? Or some method to compile my programs in a different way to test them without inadvertantly circumventing security measures?

Was it helpful?

Solution

try ideone it gives you a web based front end with the possibilities to compile code and and run it. the output of the program is then printed on the page.

OTHER TIPS

You can run the code (if it is a single file) directly from tcc without creating an executable. Use the commad line argument -run.

On my system, tcc is installed in \Utils\tcc. The file hello.c is a basic "Hello World" source file.

First I did a "dir", then 'executed' the source without creating an executable, and finally another "dir" to show nothing was created.

C:\misc>dir
 Volume in drive C has no label.
 Volume Serial Number is BC80-0D15

 Directory of C:\misc

2013-06-03  13:12              .
2013-06-03  13:12              ..
2013-06-03  13:11                86 hello.c
               1 File(s)             86 bytes
               2 Dir(s)  14,364,372,992 bytes free

C:\misc>\utils\tcc\tcc -run hello.c
Hello, World!

C:\misc>dir
 Volume in drive C has no label.
 Volume Serial Number is BC80-0D15

 Directory of C:\misc

2013-06-03  13:12              .
2013-06-03  13:12              ..
2013-06-03  13:11                86 hello.c
               1 File(s)             86 bytes
               2 Dir(s)  14,364,372,992 bytes free

C:\misc>

There are many online C++ compilers available now, the most complete list that I have seen is the one on the Get Started page from isocpp.org.

Unfortunately Cameau's seems to be gone for good. LiveWorkspace has been in maintenance mode for a while and it is not clear when it is coming back, which is unfortunate since it has a simple interface and when it was working allowed you to switch between gcc, clang and intel very easily.

Of the ones that are left Stacked-Crooked is the most powerful, you have a full command line available and you can save files and therefore uses multiple files in your project.

The isocpp list somehow is missing codepad which although rather primitive along with Stacked-Crooked allows you to use boost.

godbolt is kind of the odd man out here in that you can't actually run your program there but it shows you the assembly generated. Although you can achieve the same effect on Stacked-Crooked using something like this on the command line:

g++-4.8 -std=c++11 -S main.cpp && cat main.s

and you can use other useful command line options like -fdump-tree-original etc...

Update

I recently discovered Rextester which apparently started out as a regex tester for .net but now support C++ and many other languages. It is very usable and allows for live cooperation which is a feature that stands out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top