
On Thu, Nov 29, 2007 at 09:48:22AM +0100, apfelmus wrote:
Well, I only remember that it took _me_ a page of C code :D Basically due to a hand-coded intset and user interaction (no REPL for C, after all).
In my C programming, I've taken to using gdb as a REPL: stefan@stefans:/tmp$ vi foo.c stefan@stefans:/tmp$ cat foo.c int foo(int x) { return x * x; } int main(){} stefan@stefans:/tmp$ gcc foo.c stefan@stefans:/tmp$ gdb -q ./a.out Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x804835e (gdb) run Starting program: /tmp/a.out Failed to read a valid object file image from memory. Breakpoint 1, 0x0804835e in main () (gdb) p foo(2) $1 = 4 (gdb) p foo(10) $2 = 100 (gdb) p foo(-1) $3 = 1 (gdb) p foo(0) $4 = 0 (gdb) p foo(2)+foo(4) $5 = 20 (gdb) quit The program is running. Exit anyway? (y or n) y stefan@stefans:/tmp$ Makes most debugging tasks much easier. Stefan