6 ms·
maybe the biggest improvement in c programming over the last decade is valgrind, making purify-like debugging available to everyone. it's completely removed a
by andrewcooke 14y ago
maybe the biggest improvement in c programming over the last decade is valgrind, making purify-like debugging available to everyone. it's completely removed a whole class of annoyingly hard to fix bugs from my code.
- heretohelp 14y agoThis is why Zed pushed it so hard in Learn C the Hard Way. Some people actually had the gall to complain about him ensuring the noobies learned to use valgrind before proceeding to write any real code. Ingrateful dipshits don't remember what the pre-valgrind/dtrace days were like.
- bsg75 14y agoIs Learn C the Hard Way a useful re-introduction? Like the article, I need to re-learn C. Last time I wrote anything in C was on Netware NLMs, and it has been long enough that I have mostly forgotten what I knew.
- heretohelp 14y agoYes.
- andrewcooke 14y agoi was looking for a good book to bring me up-to-date on recent changes to c and the best suggestion i received was to get the latest edition of harbison and steel's book (which includes c99). i don't know if you know the book - an older copy is on my desk and it use it regularly when working in c - but it's part introduction and part informed guide to the libraries. it's not a "friendly" book (it's not for "dummies"), but it's well written and surprisingly compact for all it contains (at least, the copy i have is; i am waiting for delivery of the latest version).
- KonradKlause 14y agovalgrind, is only available for a few platforms/architectures. If you are unable to writer proper C programs without valgrind's help, please go home. :-)
- amouat 14y agoDepends what you mean by "proper". Any fool can get a C program to work, but ensuring there are no memory leaks etc is very hard without a tool like Valgrind. If you don't believe me, just run Valgrind on random sampling of C programs that didn't use such a tool - I reckon it will find issues with most of them.
- popee 14y agoAgreed. Valgrind can be very helpful, saved me few times. You know huge modular application, one line bug, dead end situation. Too bad output is mess, ups, full of details :-)
- dap 14y agoValgrind (and tools using its methodology) isn't the only way to solve these problems. Libumem finds memory leaks too, and without imposing an immense runtime cost. It also finds many types of memory corruption without the runtime overhead that often changes the program's behavior that you're trying to debug.
- raverbashing 14y agoYes, please, write proper C without Valgrind so I have to spend my time fixing all the memory corruption issues in it =)
- dbaupp 14y agoOne can always write proper C programs without Valgrind: it is "just" a (really useful) debugging tool. The utility of it is that instead of spending days trying to track down any mallocs missing frees, one can just run Valgrind to find them and their locations straight away.
- 14y ago
- pjmlp 14y agoTools only created to solve the lack of safe constructs in C. C made lots of sense in the context it was developed, but the world would be better if we had safer systems programming languages. Valgrind, purify and friends are required to C, the same way Java requires IDEs, to improve language usability. Have said this, the new trend in having static analysis tools integrated in the development process, like Clang, Eclipse CODA, Visual Studio's tools or HP Code Advisor, among others, can bring a bit more safety into C.
- antirez 14y agoIn the case of C safer also means weaker and less useful, it is a language where you need to be able to do everything. In some way C is "Assembler-complete". With valgrind you have no compromises, because you have a specialized runtime giving you control over what happens only at debugging time.
- tosseraccount 14y agoC is popular, good enough, portable, and fast. Skilled C programmers do not need profilers, bounds checkers and memory leak detectors. They help some people, though, no doubt. When size and speed matters, as in Operating Systems, C has won and continues to win the survival of the fittest competition. Almost all the programs I use are C (and/or C++): bash, linux, perl, firefox, awk, sed, grep, apache, mysql, etc. I assume good chunks of Java are written in C, but I'm not sure. We have "safer" languages but our systems and tools remain in C. Given the intense competition in software, there must be solid reasons C remains the foundation of computing.
- haberman 14y agoI'm with you on the advantages of C, but this is not true: "Skilled C programmers do not need profilers, bounds checkers and memory leak detectors." Skilled programmers use profilers because the alternative (guessing) is a poor strategy for diagnosing poor performance. And no skilled programmer would spurn a useful tool like a bounds checker or memory leak detector, because nobody is perfect and these tools save immense amounts of time by pointing you straight to the problem.
- WalterBright 14y agoValgrind has almost single handedly rescued C from the ashheap of history.
- emmelaich 14y agoAbsolutely. Also the gcc mudflap library, splint static checker, Torvald's sparse have really helped. And that's without the commercial tools such as Coverity.