Slashdot Mirror


Valgrind 1.0.0 Released

Anonymous Lazy Boy writes "Yesterday saw the official release of Valgrind 1.0.0. Valgrind is a C/C++ programmer's dream come true: effortless memory allocation checking, uninitialized memory access, leaks etc. Purify for Linux has arrived, only better: contrary to its commercial (non-Linux) sibling, checking is performed directly on the executable, no re-linking necessary. The technology behind Valgrind is highly fascinating and explained down to the very gory details in the documentation."

96 of 295 comments (clear)

  1. Any reviews? by ergo98 · · Score: 5, Interesting

    One thing I've found with automated QA products is that usually they have critical faults that prevent them from being realistically useful (for instance many of them grind to a halt or give false positives in multithreaded apps). How's this product for real world use? (And no this isn't a "Read the Article!" question...the article is like a press release and hence doesn't answer my question).

    1. Re:Any reviews? by Charles+Kerr · · Score: 5, Informative
      I've been using Valgrind on Pan, which is multithreaded, and it works fine. Maybe given more time I'll find features that I miss from Purify, but for now I'm very happy.

      Things I like better in Valgrind:

      • Valgrind works on Linux.
      • Valgrind doesn't require instrumenting each object file and library at build time. (This is a biggie)
      • Valgrind's run-time options are more flexible.
      • Valgrind works with both gcc 2 and 3.
      • Valgrind seems to run faster than Purify. (Different hardware and OSes, so this is a guess.)
      • Valgrind doesn't have a Motif GUI. ;)
      • Valgrind doesn't have an insane, broken license manager.
      • Valgrind's technical support is better. (Yes, I've dealt with both.)
      • Valgrind doesn't cost $2,364 per seat.

      Things I like better in Purify:

      • Purify can handle static libraries.
      • Purify makes it easier to disable errors/warnings from libraries out of your scope.
      • Valgrind doesn't work on Solaris, so I'm stuck with Purify for my day job. :)
    2. Re:Any reviews? by Kiwi · · Score: 2
      We've been using Valgrind to find memory leaks in my open source project; it caught a few subtle memory leaks which we didn't catch in our six months of testing by hand.

      I've been very pleased with it.

      I can not comment on how easy it is to use because other developers on the team have been using it instead of myself.

      - Sam

      --

      The secret to enjoying Slashdot is to realize that it should not be taken too seriously.

    3. Re:Any reviews? by Charles+Kerr · · Score: 5, Interesting
      On a Pentium 450 running Limbo, I can start up Pan 0.12.91 with valgrind --num-callers=16 --leak-check=yes --leak-resolution=med in one minute, nine seconds. On an otherwise-idle Sparc Ultra 10 running Solaris 7, it takes Pan built with "purify -chain-length=7 -cache-dir=/tmp -always-use-cache-dir=yes" more than 15 minutes to start up, with the CPU pegged at 100% the entire time.

      If there's a secret "Don't Run Slow" switch to Purify, let me know what it is.

    4. Re:Any reviews? by Citizen+of+Earth · · Score: 2

      Things I like better in Valgrind... Things I like better in Purify

      I've used Valgrind and Purify before and I find Valgrind much more useful. The big thing for me is that it runs on Linux, which is what I use for development at the office. This is the death of Purify for me, because I can get much higher performance Linux boxes than Solaris boxes for a reasonable price. The additional price of Purify to me is just adding insult to injury.

      I'm not sure what you by "Purify can handle static libraries" because I use static libraries with Valgrind all the time.

      The only thing that concerns me about Valgrind is the strange way that it tracks uninitialized varliable references: it only checks values when they are used for an index or a branch (the last time I read the documentation). Apparently it restricts to this case because people may copy around values or arrays that are uninitialized. I certainly don't do this. And I do really want to know when an uninitialized variable is first read.

    5. Re:Any reviews? by Sanga · · Score: 2, Informative

      # Purify makes it easier to disable errors/warnings from libraries out of your scope.

      Details about Valgrind suppressions at:
      http://developer.kde.org/~sewardj/docs/manual .html #suppfiles

  2. Re:Valgrid is not as complete as Purify by MisterBlister · · Score: 2
    Agreed. I use Purify constantly for my day job. I took a look at this hoping to find something nearly as good as Purify (since they advertise it as being BETTER!) and free, but there's a long long list of ways in which it is vastly inferior to Purify right now.

    Beware of gratiutious hype.

    And, btw, Purify (never used it under Linux so maybe it is different there) can also work on executables (and DLLs/SOs, etc) without a relinking. When's the last time the person who posted used Purify? 1996?

  3. Re:What's the fun in that? by MisterBlister · · Score: 2
    This may be a practical tool in some respects, but I would not have so much respect for someone who depended on that to have any working code. As the old saying goes, "real programmers read core dumps."

    Are you trolling? Or stupid? Or have you never used Purify? I've yet to meet a developer who used Purify (or in some cases BoundsChecker or similar tools, though IMO Purify is hands down the best if you can afford it) that decided it wasn't really helpful and then stopped using it.

    These tools give you SO MUCH more than just simple stack tracing after a crash. Foolish is the developer who ignores their benefits.

  4. Re:Valgrid is not as complete as Purify by mce · · Score: 2, Interesting

    The bad thing about Purify is that there ain't no Linux version.

    I have used Purify ever since it was first put onto the market by Pure Software about a decade ago. But nowadays, Linux is becoming our real development platform, so if Rational ain't careful: exit Purify. Yes, it's sad, but I've told them often enough that Linux support is what they should bring me, not yet another rewrite of their licensing scheme.

  5. An excellent tool by alriddoch · · Score: 5, Interesting

    Valgrind really is an amazing bit of software. Working on large application which use many different libraries it becomes harder and harder to work out where those bugs are, and all the free tools I have tried so far have done a very poor job of finding them. I have now been using valgrind for several months, and got 1.0 straight from the author by mail having reported a few bugs in earlier versions. It speeds up finding those hard to reproduce bugs, and often shows up memory errors which you didn't even know were there. It is also excellent for detecting memory leaks as it knows the difference between memory that has been genuinly leaked, and memory which is not freed, but still has a reference to it stored when the program exits. All the software I work on is now much more robust than it was a few months ago, and much of this I can put down to valgrind being available. This is the only free tool that comes close to the commercial tools like Purify, and in many ways it is superior to some of the expensive high end tools. The author is extremely responsive and helpful, and has been developing valgrind full time self funded.

  6. Wow! by jelle · · Score: 2

    I've been waiting for this. I've seen the malloc debuggers and the like (electric-fence, gccchecker, etc), but they're all incomplete, have problems with C++ code, or are just for allocated memory ('new'-ed objects, malloc()-ed data, etc), not for regular vairables: statics, local variables, etc.

    But valgrind seems to be just right I gave it a quick tryout and it is looking good!

    Wow.

    apt-get install valgrind.

    And all we need now is a gvalgrind, and/or a kvalgrind gui interface just like purify has and I'm all happy.

    --
    --- Hindsight is 20/20, but walking backwards is not the answer.
  7. Re:Valgrid is not as complete as Purify by jelle · · Score: 4, Insightful

    "but there's a long long list of ways in which it is vastly inferior to Purify right now"

    How about showing us that list?

    --
    --- Hindsight is 20/20, but walking backwards is not the answer.
  8. Re:What's the fun in that? by superpeach · · Score: 2, Insightful

    Good programmers will not depend on something like this to get their code working, but it will still be a great tool for them to make sure they didnt mess up somewhere in the last 9hours of solid coding. Its probably kind of like wearing seatbelts, you dont need them to be able to drive but if something goes wrong they come in quite handy.

  9. Too slow to always enable by GGardner · · Score: 2, Troll

    One of the many great things about purify is that (IME) it only slows down your code by 10-20%, which is small enough that you can always leave it in your code. Leaving it in for unit testing, integration testing, system testing, beta testing, etc., can make your life much easier.

    Valgrind, however, runs your code 20-50 times slower, which means you can't have it on all the time. This is unfortunately, for it looks like a great tool, otherwise.

    1. Re:Too slow to always enable by cant_get_a_good_nick · · Score: 5, Insightful

      I think this is a bit misleading, it's actually a Linux/x86 virtual machine. valgrind is an environment, not just a library you link to. You don't "enable" it on your binary, you need to specifically run something under this VM. It's more akin to running something through the debugger "hey, lets do our daily/weekly valgrind run" than something you could run all the time. Or maybe do it when you have specific errors and wnat to smoke them out. It's a totally different type of tool.

      I think the VM concept is quite clever. It would be interesting to see debates about it. On the good side, it cheks EVERYTHING, not just stuff you turned the switch on for. Even bad system libraries (it has switches to turn these off so you don't get deluged by them). On the bad side, it's obviously Linux/x86 only. I guess it pays to keep your code portable. I'm in a SPARC/Solaris only shop, but I could see myself keeping things portable to linux enough to run this, say once a week to ferret out bugs.

    2. Re:Too slow to always enable by GGardner · · Score: 2


      For my real code, big applications only slow down 10-20%. I've measured it. Now, this is on Solaris/SPARC, which I suspect is a much more efficient platform than x86. How much slowdown do others see?

  10. recursivity by alvi · · Score: 4, Funny

    Hum,

    [chicken]~> vagrind valgrind

    seems to work ok. But valgrinding a valgrinded valgrind causes some ugly errors and asks for a bug report. Well, I know this isn't fair. :)

    Anyways, this looks like a really sweet tool.

  11. GDB is BIG and old valgrind help's by johnjones · · Score: 2

    I Had to debug GDB and Valgrind helped me find memory leaks in this and gdbTK

    GDB is pretty icky so thats a ugly program for you it also managed to debug my ARM/MIPS sim which is small

    overall I give it 5 stars

    regards

    john jones

  12. Re:Valgrid is not as complete as Purify by Polo · · Score: 2

    Especially since purify doesn't run on linux...

  13. Re:BACKDOOR in Valgrind - Please Read by michael · · Score: 4, Informative

    Please don't feed the trolls. All the posts claiming a backdoor in Valgrind and supposedly responding to each other ("Hey, I found it too!" "Me too!" "Here's what I got!") were all posted by the same person.

  14. Re:Strangeness by mrm677 · · Score: 2, Offtopic

    I do hope that the moderator whom is labeling these posts as "trolls" has done his/her homework regarding the accuracy of this and following posts...

  15. What the... by handsomepete · · Score: 2

    I was just reading this thread and everything was +2/+3 informative. Suddenly everything has been knocked to 0/-1. Did we discover some relevant piece of information about the posting ACs that made that a wise decision? This sounds like it's at least kind of important. What's going on?

    1. Re:What the... by dvdeug · · Score: 2

      Did we discover some relevant piece of information about the posting ACs that made that a wise decision

      You mean besides the fact that everyone reporting a problem is Anonymous Coward, except for Theo deRaadt (hint: look at the OpenBSD webpages - it's Theo de Raadt.) Considering a #5000 level user says there's no problem; well, I know who I believe.

  16. Use garbage collection by WanderingGhost · · Score: 2, Informative
    If you're woried about memory allocation, use garbage collection:
    http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_so urce

    And contrary to what you may think, it's qiute easy to use:

    variable = new (GC) my_class;

    Or even easier: make your classes derived from gc.

    In C, you just replace malloc.

    And I have found that there is no slowdown wen using a garbage collector. It's nice, and keeps the code clean. Try it someday.

    1. Re:Use garbage collection by ceswiedler · · Score: 2

      There are two camps when it comes to this sort of thing. One says that developer time is more important than processor time (you seem to fall into this one) and therefore GC is a great thing. I would say that 80% of development projects fall into this category.

      But in the other 20%, performance is more important than development time, and for these projects, GC is clearly a bad idea. In some situations even C++ is a bad idea. You really really wouldn't want to write an operating system with C++, much less with GC. There are times when developers need complete control, and high-level languages and features like GC take that away.

    2. Re:Use garbage collection by p3d0 · · Score: 5, Interesting
      You really really wouldn't want to write an operating system with C++, much less with GC.
      Bull.

      Be was written in C++, and so is K42, IBM's next big massively scalable Linux-compatible kernel. Some of the smartest people I have ever met work on K42, and these guys know C++.

      Also, GC doesn't necessarily add any overhead to programs: it depends on memory usage patterns, but clearly, being forced to free everything chunk-by-chunk as it's no longer needed can't always be the most efficient policy. (Otherwise, why do program call stacks use special-purpose storage management instead of the heap?)

      Having said that, it is true that a conservative collector is not suitable for all memory allocation needs.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    3. Re:Use garbage collection by cpeterso · · Score: 4, Interesting


      The Be kernel was written in C, not C++. Be's user libraries were written in C++.

      Interestingly though, Apple does use (a simplified subset of) C++ for Mac OS X device drivers. See the Apple IOKits.

    4. Re:Use garbage collection by sethg · · Score: 2
      Some folks on the lightweight-languages list have pointed out that malloc/free are not instantaneous, either, so if a program needs to allocate and deallocate lots of memory, using a GC can be more efficient than using malloc/free -- it all depends on the subtleties of the algorithm you use and the way your GC or malloc library is tuned.

      In any case, a GC doesn't always save you from memory leaks. Contemplate the difference between live and reachable objects. A live object is one that the program will actually use at some point in the future. A reachable object is one that the program could use. GCs reclaim un-reachable objects, not un-live ones.

      --
      send all spam to theotherwhitemeat@ropine.com
    5. Re:Use garbage collection by ceswiedler · · Score: 2

      Just because it's been done doesn't make it a good idea. You obviously know something about OS programming (though someone corrected you about the Be kernel). But you can't deny that the majority of modern operating systems are written in C, and not C++.

      My point is that there is no GC algorithm which you can write (ahead of time) for a given application that is better than the GC implementation I can custom-write for my application. I can analyze my code and decide for myself when memory should be freed. It's the same thing with compilers; compiler-generated code is never going to be better than the hand-written code of a good programmer.

      Now, everything is a tradeoff, and I'm all for compilers and GC when appropriate. But another thing I've noticed is that programmers get dependent on GC. More than that, a program written for GC (i.e., without any free() or delete calls) cannot be ported to a system which doesn't support GC.

  17. Re:Strangeness by Rob+Kaper · · Score: 2, Informative

    Hi. KDE developer here. We've checked developer.kde.org (the machine hosting Valgrind) and the md5sums. So far this looks like a hoax, so please move on. We will stay on the alert and continue investigating, but to quote one of my favourite authors: don't panic.

  18. Re:Strangeness by Charles+Kerr · · Score: 3, Informative
    I know I shouldn't feed the trolls, but just for fun:

    (18:14:38)(~/src/valgrind-1.0.0): grep open vg_scheduler.c
    (18:14:45)(~/src/valgrind-1.0.0): grep 11 vg_scheduler.c
    02111-1307, USA.
    (18:14:52)(~/src/valgrind-1.0.0):

  19. Re:What's the fun in that? by Greg+Lindahl · · Score: 3, Funny


    I am neither trolling nor stupid, and I don't find Purify that useful. I am also not as insulting to people who don't agree with me.

    In the 60's, we programmed in Fortran, and debugged with PRINT statements.

    In the 70's, we programmed in Pascal, and debugged with WRITE statements.

    In the 80's, we programmed in C, and debugged with printf statements.

    In the 90's, we programmed in C++, and debugged with >>.

  20. Why your post is a troll by Vicegrip · · Score: 5, Insightful

    valgrind is freely downloadable *with* the source. Here we have someone that has put toghether a very impressive tool which, you admit yourself, does things that require 3rd party tools to do on Windows, and all you find to say "I don't care because stuff on Windows sorta maybe does it anyways".

    Instead of commending somebody on their very talented effort and for making it all Free, all you do is make loud claims that memory management isn't the way of the future for "us l33t modern day programmers"-- followed by the amazing claim that C memory allocation is somehow sub-optimal.

    The fact is that for all that vaunted "10 years" advance you claim the Microsoft C runtime has, memory management has been the bane of every product Microsoft ever produced.... I still get company wide emails twice/thrice weekly of this or that exchange server needing to be rebooted again.

    If I had mod points, I most certainly would have modded you a troll.

    --
    Do not spread "09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0" over the internet, thank you.
  21. Re:Valgrid is not as complete as Purify by XaXXon · · Score: 2

    And, btw, Purify (never used it under Linux so maybe it is different there) can also work on executables (and DLLs/SOs, etc) without a relinking.

    You wanna know why you've never used Purify under Linux? Cuz it's not available. AFAIK, no Rational tools are available for Linux. When I was looking for Linux tools at my previous job, the only memory checker available for Linux was insure++. I also found that there were no commercial profilers available for Linux. gprof just doesn't cut the mustard, especially in multithreaded apps, and Rational's Quantify wasn't available for Linux. When I called Rational to ask if they planned on supporting Linux, they said "Maybe sometime in the future", but when I continued questioning them, they said they had no immediate plans to start working on Linux versions of any of their software.

    So, while Valgrind may not be as complete as Purify (I don't know if it is or not), it's a helluva lot cheaper than insure++ (~$4K license -- well worth it if it's not your money), and better than any other Free software I've seen.

  22. Correct md5sum by Anonymous Coward · · Score: 2, Informative

    Hi,

    I have just verified that we have no evidence of
    a backdoor in valgrind.
    This is the correct md5sum
    76c59f7f9c57ca78d733bd956b4d94ae valgrind-1.0.0.tar.bz2

    I will put this information also online on
    http://www.kde.org/md5sums/valgrind-1.0.0.tar. bz2. md5sum

    So you can check this information via a second channel.

    Yours,
    -- martin
    P.S.: The AC claims incorrectly that exact the above md5sum indicates a compromised archive which is plain wrong!

  23. Re:PurifyPlus+MSDEV.EXE+icl.exe has yet to be beat by joss · · Score: 2

    oh please... SGI had fix and continue plus debuggers way better than VS7 8 years ago. Proper interactive debugging (type call blabla::XX(5,8) to step into member function etc and purify hasn't improved since rational bought it.

    --
    http://rareformnewmedia.com/
  24. I think you're confused by adam_megacz · · Score: 2, Interesting

    There is no "GNU version of Java".

    GCJ supports everything in Java 1.2 except for AWT (most people aren't using Java for GUIs anyways), almost all of the 1.3 stuff, and a large portion of the 1.4 stuff.

    Most Java software out there today (Tomcat, etc) is designed for Java 1.2. Not much changed in 1.3/1.4.

    In a pinch, you can actually take the .jar's from Sun's Java distro, run them through GCJ, and get native code binaries. You can't redistribute these, but it's handy if you're writing server code rather than shrinkwrapped software.

  25. Could Valgrind be an alternative to Bochs? by splorf · · Score: 2, Interesting
    It looks like it has its own instruction level simulator that does binary translation and runs a lot faster than Bochs. It may not try to simulate privileged instructions, but maybe that could be added, so you could run operating systems under Valgrind.

    Could some kind of merge be possible, adapting Bochs to use Valgrind's simulator without the malloc-checking stuff? Also, I wonder if Valgrind could be adapted to simulate other CPU's besides the x86.

    1. Re:Could Valgrind be an alternative to Bochs? by JFMulder · · Score: 2

      Nah, I don't think so. I've read a bit about Valgrind and I'd be surprised if it emulated all the PC hardware like Bochs does. Bochs is interresting because it emulates an entire PC, so it's ideal for OS development.

  26. Re:Strangeness by idealego · · Score: 2, Funny

    Trolls are busy at work today I see.

    I actually wasted about 15 minutes looking into this.

  27. Re:Call me ignorant if you like... by Alan+Cox · · Score: 2

    They only apply to USSA citizens and other backward nations. I would not be suprised if Valgrind had US patent issues, but then so does just about anything but breathing

  28. Re:Strangeness by rjh · · Score: 3, Informative

    I've just grepped through vg_scheduler.c looking for `bind', `sock', `11', `RAW', `raw', and several others. I've come up with absolutely nothing. Admittedly, I haven't checked out the entire source--at 3500 lines, it'd take me several days to do a proper audit--but so far I haven't found any references to socket calls anywhere.

    Still, I would appreciate it if the maintainer could check out vg_scheduler.c and see if there's something amiss there. Thanks. :)

  29. Garbage collection vs direct allocation/release by Anonymous+Brave+Guy · · Score: 3, Insightful
    In our world, we are moving towards garbage collection. It rocks. The simple truth is that C-style memory allocation is well understood, sub-optimal, and obsolete.

    C-style memory allocation is the basis for any garbage collection system. It may not be the right tool for every job -- certainly it is smart to build a more powerful system atop it -- but it is not obsolete, and never will be as long as programming remains in an environment similar to what we have today. And it is optimal for what it does. That's why you build a GC on top of it, and not the other way around.

    And of course, you have to be careful with claims that garbage collection is some sort of panacea. I almost never use new and delete in C++, for example, because I have automatic local variables, implicit temporaries, and deterministic destruction at the point where either go out of scope. People somehow think that it's clever that you can write

    Blah x = new Blah(10);

    in Java, and that if you write

    Blah *x = new Blah(10);

    in C++ it's inferior because you have to delete it afterwards. They ignore the fact that the vasty majority of the time, you're actually going to write simply

    Blah x(10);

    instead, and have no worries about releasing memory, or failing that, you're going to use a suitable smart pointer class and similarly have no worries. And in languages with "low level" allocation like C++, you get deterministic destruction in the picture as well, which is a massive advantage over the GC approach as evidenced in languages such as Java (and many others, too).

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Garbage collection vs direct allocation/release by Anonymous+Brave+Guy · · Score: 2
      In fairness, if the language protects them from their own incompetence, it can rightfully be said to be superior in some sense. :-)

      That is certainly true. OTOH, if using a feature restricts what you can do (e.g., using a GC typically prevents deterministic destruction) then it is not necessarily superior overall.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  30. Re:Valgrid is not as complete as Purify by Pauly · · Score: 4, Interesting
    Especially since purify doesn't run on linux...

    Excellent point. It's also another reason why I've found Parasoft's Insure++ to be superior to Purify.

    I'm sincerely looking forward to checking out Valgrind. Can someone post a feature comparison of these three?

  31. Wow, Debian version already updated by Anonymous Coward · · Score: 2, Informative

    1.0 is available in unstable.

    Cool.

  32. Re:What's the fun in that? by MisterBlister · · Score: 4, Funny
    In the 80's, we programmed in C, and debugged with printf statements. In the 90's, we programmed in C++, and debugged with >>.

    So you *are* stupid after all!

  33. Re:Valgrid is not as complete as Purify by mce · · Score: 3, Informative
    When I called Rational to ask if they planned on supporting Linux, they said "Maybe sometime in the future", but when I continued questioning them, they said they had no immediate plans to start working on Linux versions of any of their software.

    Franckly, I have the impression that Rational regard Purify and Quantify as cash cows that should not be touched unless absolutely required. All they ever did since they bought them was:

    • implement a Windows version (there's more cash at hand in that world);
    • change the licensing scheme to be ever more annoying;
    • fix minor annoyances after HP or Sun released new compiler versions;
    • finally add gcc support for version 2.95 when 3.0 had already been released for some time.

    Other than the gcc 2.95 thing, I have seen no real improvements in years (I don't use Windows). Over the years, we forked over a lot of money for "support", though.

    It's a great tool, but I'm not impressed with the company behind it.

  34. Market for commercial programming tools for Linux by jreiser · · Score: 2, Interesting
    I developed a product for Linux/x86 with functionality similar to Purify and valgrind, and offered it for sale three years ago (June 1999) at $99 per user. Market response was underwhelming: in eleven weeks only seven licenses were purchased, and three of those were by competitors or academics who ran the tool only to find out how it worked, and never used it beyond that.

    Today BitWagon offers a profiling product tsprof which requires no recompile and no relink, and handles main programs, shared libraries, dynamic modules, pthreads, and SMP; does direct time and event measurement based on hardware counters (no sampling) and provides highly effective interactive graphic output in addition to tabular text. So far, response again lags. Maybe Rational is onto something.

  35. Re:What's the fun in that? by Anonymous Coward · · Score: 2, Interesting

    So, basically, you are saying that you work in the most inefficent way possible because it makes you more manly. I tire of people who will try new tools and techniques because it isn't the way our forefathers did it. Bottom line: I can find and fix defects faster with a debuggers and such than with prinln/>>/printf etc. Hence, the reason we call it a "Poor Man's Debugger." As an engineer, you should always be looking to improve the efficency with which you work. End of discussion.

    Whether or not you like Purify and its ilk are inconsequential, but your refusal to open your mind to new methods and techniques are what repulses people. Attitudes like yours create COBOL and FORTRAN system maintainers -- not true software engineers.

  36. Re:What's the fun in that? by iabervon · · Score: 2

    Read the core dump? Ha! Good programmers know what's wrong from when the segfault occured.

    But if you're going to use tools, having a tool that tells you when a value gets written somewhere wrong is far better than one that tells you what was going on when the program actually crashed.

    This is actually vital for bugs where an uninitialized value is assumed to be zero, and it always is zero in your tests, but...

  37. Re:Market for commercial programming tools for Lin by movement · · Score: 2, Informative

    Here's some suggestions :

    1) don't charge such an absurdly large price
    for software mostly built on free software
    (Mikael's perfctr)

    2) accept that when you have competition that
    is free software, it's gonna beat you.

    [Disclaimer: I am indeed the lead developer for
    your competition]

    --
    -- Remove the trailing '\0' to email me.
  38. Re:What can I say: Linux is the best by istartedi · · Score: 2

    That's why they are holding on to their pile of cash. There is talk of them forming "Microsoft Capital" which would provide financial services like GE Capital does.

    So, the Linux crowd might get their wish and find that one day MSFT is a bit player in OS software, or perhaps even discontinues their OS someday. In fact, I wouldn't be a bit surprised if Bill Gates actually dreams of discontinuing Windows so that he can just own shares in a nice reliable big banking and financial services conglomerate during his golden years.

    This will leave a bitter taste in the mouths of those who are truly vengeful and hate "M$". Like most people who have the winning way, BG and company will go on about enjoying their lives scarcely even conscious of those who hate. Meanwhile, the hateful will continue eating ramen and lamenting what they see as the injustice of the world. Those who simply wanted a better OS will probably eat ramen too. The difference is that they will do it with contentment, because they too have the winning way.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  39. What a hammer! by Animats · · Score: 2
    Valgrind makes you realize how much excess CPU time and memory we have available today. The thing has huge memory and speed overheads, yet today's machines are fast enough, and have enough memory, that valgrind's big-hammer approach to the problem works.

    Still, why not do it that way? Machine resources are cheap.

    1. Re:What a hammer! by cant_get_a_good_nick · · Score: 2
      From The Art of Unix Programming, Chapter 1
      Programmer time is expensive; conserve it in preference to machine time,

      In the early minicomputer days of Unix, this was still a fairly radical idea (machines were a great deal slower and more expensive then). Nowadays, with every development shop and most users (apart from the few modeling nuclear explosions or doing 3D movie animation) awash in cheap machine cycles, it may seem too obvious to need saying.

      Somehow, though, practice doesn't seem to have quite caught up with reality. If we took this maxim really seriously throughout software development, the percentage of application written in higher-level languages like Perl, TCL, Python, Java, and Lisp that ease the programmer's burden by doing their own memory management would be rising fast.

      And indeed this is happening within the Unix world, though outside it most applications shops still seem stuck with the archaic Unix strategy of coding in C (or C++). Later in this book we'll discuss this strategy and its tradeoffs in detail.

      One other obvious way to conserve programmer time is to teach machines how to do more of the low-level work of programming. This leads to...
    2. Re:What a hammer! by elflord · · Score: 2, Insightful
      Somehow, though, practice doesn't seem to have quite caught up with reality. If we took this maxim really seriously throughout software development, the percentage of application written in higher-level languages like Perl, TCL, Python, Java, and Lisp that ease the programmer's burden by doing their own memory management would be rising fast.

      Many of these high level languages have problems of their own. Languages like Python, Perl, and TCL lack any sort of compile time checking, which makes them error prone, and less scalable. This is why you don't see many applications that are millions of lines long developed in these languages. Simply put, memory management is not the only issue that programmers deal with maintainability is very important, and robust compile time checks, and the clarity that comes from having to explicitly declare interfaces and having the compiler check types is a maintenance benefit.

      And indeed this is happening within the Unix world, though outside it most applications shops still seem stuck with the archaic Unix strategy of coding in C (or C++).

      Another fallacy -- that C++ is somehow "equivalent" to C. C++ does not make memory management as simple as java, but it is certainly simpler than C, and arguably, for nontrivial applications, it is at least as good as languages that force a reference counted system on the user (python, perl) as reference counting is often not an appropriate memory management model.

    3. Re:What a hammer! by BillGodfrey · · Score: 2

      Eric Reymond clearly isn't an embedded programmer.

    4. Re:What a hammer! by dvdeug · · Score: 2

      Eric Raymond may not be an embedded programmer, but neither are most of the programmer's he's talking to. He clearly recognizes there are exceptions to the rule - "Nowadays, with every development shop and most users (apart from the few modeling nuclear explosions or doing 3D movie animation) awash in cheap machine cycles". In any case, embedded programming tends to worry about trading cycles for reliability, which has some of the same principles.

    5. Re:What a hammer! by BillGodfrey · · Score: 2

      Well, so much for distributed computing.

      I'm hoping that soon, someone will run a distributed project, paying people for work done instead of just a chart of top workers.

      Idle cycles would be worth something.

      Bill, ho hum.

  40. Being wrong != being a troll by Sanity · · Score: 2, Insightful
    You give a great explanation of why he is wrong, but I don't think that justifies a troll moderation. In fact, I really wish that Troll and Flamebait moderations were removed, since they are just begging people to moderate based on agreement/disagreement, rather than their actual intent.

    Moderation privs should not be used to suppress opinions with which you disagree.

  41. I don't know about you... by Akardam · · Score: 2

    ... but I try not to dream in and/or about C/C++. It hurts. :)

    On the other hand, dreaming in perl is probably pretty close to the programmers version of an acid trip. The colors!

  42. Of course you can just avoid those errors... by voodoo1man · · Score: 2, Informative

    For most applications, it just makes better sense to avoid these errors altogether by using a good garbage collector.

    An excellent implementation is the Boehm-Demers-Weiser (commonly referred to as just "Boehm gc") conservative gc. It can be used for C/C++, and is highly portable. It's a real-time, non-compacting (so you still get heap fragmentation like managing memory by hand, but the collection time is shorter and it's more portable), and uses a conservative mark-sweep algorithm (briefly, treats anything that looks like a pointer as a pointer, to avoid costly checks or increase portability in the case of C/C++.)

    For a moderately large amount of garbage, the incremental collection pauses take less than about 5-10 milliseconds (hence why it's a real-time collector) on a PIII-500, the algorithm scales fairly well, and it's suitable for all but the most time-critical (anything video related) or memory-thrashing (I really don't know of any app that needs to be) programs. GC will speed up development time tremendously, and can eliminate segmentation faults and memory leaks for most programs. I really don't understand why more projects don't use it.

    That being said, Valgrind does seem extremely useful for projects that do need to allocate memory manually. It looks very convenient to use, and the thoroughness of the checks is impressive. The implementation does seem a little uncomfortable to me - it's certainly a lot of effort to write a whole virtual machine just for the task! The portability prospects aren't appealing either.

    --

    In the great CONS chain of life, you can either be the CAR or be in the CDR.

    1. Re:Of course you can just avoid those errors... by JoeBuck · · Score: 2

      valgrind isn't just a GC, it detects use of unitialized variables as well, and that is, if anything, more important.

  43. Re:Valgrid is not as complete as Purify by leob · · Score: 3, Informative

    There are two important features of Purify that are most notably absent in valgrind:
    - the ability to specify user's memory allocators/deallocators (it is mentioned in the documentation, though)
    - the ability to detect array bound violations (Purify's ABR/ABW).

    You decide which of the two is more important for you.

  44. excuse me, but... by sinserve · · Score: 2

    (let ((I (get '*lisp* 'programmer)))
    `(been I ,no-worry-about-GC)
    (setf (get 'I 'skill) '(good programming techniques))
    (with-carelessness
    (learnt (have I) 'to-code
    (with-no-worry-about
    :memory-management
    :optimization
    :ease-of-use t))))

    1. Re:excuse me, but... by jtdubs · · Score: 2

      Amen brother...

      Justin Dubs

  45. Re:What's the fun in that? by unoengborg · · Score: 2, Insightful

    You mean just like real programmers don't use, editors
    but write the code directly to the compiler input stream. They don't need debugging tools either.

    --
    God is REAL! Unless explicitly declared INTEGER
  46. Re:If you're worried about threading/memory bugs by adam_megacz · · Score: 5, Funny

    you obviously have no idea what you're talking about

    $ grep Megacz /usr/src/gcc-3.1/MAINTAINERS

    Adam Megacz adam@xwt.org

    Yeah, I probably know absolutely nothing about gcj...

  47. More than just a GC. by sconeu · · Score: 2

    A lot of people seem to be saying, "Just use a good GC".

    But from reading the Valgrind docs, it's more than just a GC. It checks for accessing memory through uninitalized variables, too... Very cool.

    Disclaimer: I have not used valgrind yet, just read the online docs

    --
    General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
  48. Linux and glibc impediments to programming tools by jreiser · · Score: 2, Interesting
    Win32 has a not-so-secret advantage: VirtualQuery(), a random-access, binary structure interface to /proc/pid/maps. It's painful being required to parse a sequential text file that does not quote filenames in order to ascertain the status of the address space.

    And wouldn't you really rather be told when the dynamic linker has added or removed modules? The current interface to DT_DEBUG, _r_debug.r_brk, _dl_debug_state might be suitable for a controlling process, but it's painful for a same-process debugger. For instance, on x86 there might be only one byte of code at _dl_debug_state(), so you cannot easily overwrite it with an arbitrary transfer of control. And if you use an int3 and SIGTRAP handler, then you cannot run gdb at the same time.

  49. Re:What's the fun in that? by mcfiddish · · Score: 2

    What about libraries that are doing all kinds of memory allocation behind the scenes? I'll be jiggered if I know what the hell XAlloc-this and XFree-that are doing.

    Using valgrind, I've found several memory leaks in my code using the libX11 and the FreeType libraries that strictly were my fault, but were counterintuitive and I never would have found them solely reading the documentation and using print statements.

    I'm thrilled to have a tool like valgrind on linux, finally. Thanks Julian!

  50. Re:Awesome by nathanh · · Score: 2
    We have had this in the Microsoft runtime library for umm... ten years or something...

    No we haven't. MSRT bundles a fairly normal bounds checker. From reading the documentation it seems valgrind is a CPU emulator with memory read/writes logged and analysed.

    I can see a troll moderation coming on.

    And you deserved it.

    In our world, we are moving towards garbage collection. It rocks. The simple truth is that C-style memory allocation is well understood, sub-optimal, and obsolete.

    Perhaps, but until we have finished moving there will be a need for tools like this.

  51. Re:Valgrid is not as complete as Purify by Citizen+of+Earth · · Score: 3, Interesting

    the ability to detect array bound violations (Purify's ABR/ABW)

    Practically speaking, I think that it frequently does. It allocates memory blocks in such a way that writing beyond the end of an array (or before the start) is detected as a bad-memory access, so it will catch array-bounds problems for dynamically-allocated 1D arrays and frequently n-D arrays.

  52. Re:PurifyPlus+MSDEV.EXE+icl.exe has yet to be beat by Doomdark · · Score: 2
    nothing beats an XP box with Visual Studio 7, Intel C/C++ 6 and Rational PurifyPlus.

    Valgrind, alas, does nothing much to help.

    Um, Valgrind apparently can more or less replace PurifyPlus, which is not available on Linux. PP was one of 3 dev components you mentioned. Thus, one third of the problem solved (or alleviated).

    So how is not doing much to help?!?! You think it's ok to have have 3 (somewhat) separate tools on Windows, but in Linux one tool needs to do it all? What am I missing herE?

    --
    I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
  53. Re:Buy a faster computer? by mcfiddish · · Score: 2


    Developers workstations are *supposed* to be bigger better faster more than those of the plebes, and don't you forget it! :^)

    Don't laugh, but I think the opposite is true. I do all of my development on a 600Mhz Pentium II, because if I can get my code to perform well on that box, it'll be that much faster on most machines in the "real world".

  54. valgrind can handle static libraries by JoeBuck · · Score: 2

    I've used Purify for nearly a decade, and have been banging on valgrind for several months as well. I think that two of your three criticisms of valgrind are off base.

    valgrind copes with static libraries. The only requirement is that the executable be linked to at least one dynamic library, and glibc will do. This is needed to allow valgrind to get control. Since for Purify you need to have the .o files so you can link, in the analogous situation with valgrind you can always link dynamically with the C library.

    Valgrind has a suppression file that is much like that of Purify.

    The only point you raise that is completely valid is that valgrind is x86-only. Those who really care might want to work on a port to other architectures, though it's a big job: you need a complete virtual processor.

    Purify's GUI can be quite useful, but it would be preferable, if someone wants to do the same for valgrind, to implement any GUI as a completely separate program. That way the KDE and Gnome people can assure that there are at least two of them. :-)

    Finally, to be fair I suspect that a Purify'd executable is faster. But then, you don't have to do a special, expensive link step, so the compile-debug-recompile flow feels faster with valgrind.

  55. Re:Market for commercial programming tools for Lin by Wumpus · · Score: 2

    I've never heard of tsprof until I read your post here. Maybe that's part of your problem. When I searched Google for 'Linux profiler', It didn't show up in the first fifty results or so. This means I wouldn't have found it had I been looking for a profiler right now. Maybe the text on your web page should include the word "profiler"? I would assume that most people looking for a profiler would search for it by that name.

    You could try getting more people to link to your web page, or find other ways to get the word out. Unfortunately, you have pretty tough competition, and you can't beat their price. I don't know what you've done to market tsprof, but it was probably not enough, or it was done the wrong way.

    Your Flat profile window looks awsome, by the way. Would have been cool if you colored it using only 4 colors, though...

    Good luck!

  56. Re:Where have you been?(wasRe:x86 VM) by j3110 · · Score: 2

    yea, a clever reply! :)

    I'll just start by saying that I'm not just a Java programmer. I have about 5 years of experience in C++. I did mainly server side programming and no real GUI, just moving around data.

    C/C++ do not give you complete control over execution. You can't tell me you don't link to libraries. If you don't, then you are throwing away hours of time that your competition is adding features. At some level, you have to deal with an OS that may or may not work the way you expact as well.

    Java does manage to do garbage collection for about 20% penalty, and LISP isn't bad at all itself. If other people can do it right, then why not C/C++? It really doesn't have to be as bad as people make it out to be. Think about the logistics of it sometime. It wouldn't be difficult or too taxing to keep a hierarchy of pointers in a central class/table and call a cleanup function every 10 seconds or so to check where pointers have changed and which memory addresses allocated are no longer being referenced. I would like for it to be done at the language level because frankly, the people who would care enough to do such a thing to begin with would probable not have memory leaks anyhow. Those that do debug their software should be writting more good software and features instead of debugging something that is unneccisary. Not that GC should be forced, but it should at least be an option!

    Just because there is an ISO/ANSI standard for C/C++ doesn't mean that people follow it, yet they still call it C or C++. At least with Java, if it has the cup, you know it passed the certification. Don't get me wrong though, it's not that I don't think it should be open to the public, I just don't think it should be called C or C++ when it isn't really. Honestly, do you think that GCC is perfectly ANSI compliant? I don't see how since v3 caused everyone to fix some of their non-ANSI code. It still supports multi-line string literals despite the ANSI standard. There's as much of an ANSI standard for C/C++ as there is for SQL. It's very difficult to write SQL or C/C++ code that works on multiple compilers in the way you intend. ISO/ANSI has been a complete failure in ensuring that the standard is followed.

    I think that even for the user's sake there needs to be some consistancy between GUI's. Native GUI's are a terrible thing in most cases. Just because it looks like the host operating system doesn't make it a good thing. Really, the most successful programs are skinnable and look nothing like the host OS. Winamp and Trillian are good examples on the windows side where massive amounts of people have adopted programs that don't look like windows. Also, I would say, gkrellm is a great example for Linux. Native GUI's aren't really all that good of a thing.

    Don't be so afraid of Java. ISO/ANSI are independant companies for profit themselves. I fail to see the difference between them and the JCP. Java applets that I wrote as a student 6 years ago still work today, can you say the same for all of your C++ programs? Do they still compile? Do they still run in binary form? Yes to both on the Java side of things. The world is going to GC whether C/C++ wants to go or not. Micrsoft, IBM, SUN, Apple, and even Oracle know it.

    --
    Karma Clown
  57. Re:Valgrid is not as complete as Purify by jelle · · Score: 3, Informative

    IIRC purify also doesn't guarantee to catch all oob accesses, so they probably use a similar technique.

    --
    --- Hindsight is 20/20, but walking backwards is not the answer.
  58. No silver bullet by Pseudonym · · Score: 2

    OK, first, what we seem to agree on...

    • Yes, GC makes your code cleaner.
    • Yes, GC is easy to use.
    • Yes, GC usually does not slow down your code. (That is, what you gain in the ability to use better algorithms is usually greater than the cost of running a garbage collector.)

    However:

    • It does not solve all of your memory problems. C++ still lets you write out of the end of memory blocks. (Not that you should be using C-style arrays in C++ if you can at all avoid it.)
    • It does not interact well with several well-used C++ idioms, such as the resource acquisition is object creation idiom.

    The latter, IMO, is the more serious of the two. If an object holds a resource, then until it is destroyed, the resource is held. Even the best general-purpose garbage collectors you can find today do not guarantee a maximum time between an object becoming unreferenced and being cleaned up. This goes double for conservative GC, where the resource might not be freed until everything which looks like a pointer to the resource-holding object disappears.

    So in summary: I'm a big fan of GC, but it doesn't solve all my problems, and that's especially true in C++.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  59. Re:Linux and glibc impediments to programming tool by spitzak · · Score: 2
    I'm not sure if this is the same as VirtualQuery() but I think it would be nice if a lot of the structured files were divided down into many more and much smaller files. So for instance that filename you want is actually the contents of a single file. I would expect this is easy with proc(). It should also be done with all the machine configuration but I expect reiserfs would be needed for that to be efficient. This would give the few advantages of the Windows calls (ie the registry calls do get you a single field without any more parsing needed) but also allow normal filesystem tools to be used.

    Of course I'm not sure if there is any chance of this happening because it will break all the tools everybody is using now...

  60. This shows the weak spot of C++ by Otis_INF · · Score: 2

    No offence, but if you need a 3rd party tool to check if the output of the compiler, which was produced after the compiler found that the input (your code) was correct, is correct, perhaps it's time to take a step back and think about a better solution that will fix what I call the 'weak spot' of C++: you have too many stuff to take care of, it backfires on you.

    Today, the software that's used to develop software should be there to help developers write solid code from the start without overhead, without the necessity to program the plumbing code which makes your program logic run in the first place.

    Some people here have suggested that GC is a better solution than just feed your compiled binary to another tool in the chain of tools and I agree. When you look at .NET and the Java platform, you'll see that there isn't a necessity for the overhead you have to program with C++, so there's also no need for tools like purify or valgrind.

    For solutions where C++ is the only way to go, it's probably a welcome addition to the set of tools to work with, but for C++ in general it isn't IMHO, it only shows where C++ should be improved, or better: where the RTE of C++ should be improved so these tools are obsolete in the future.

    --
    Never underestimate the relief of true separation of Religion and State.
    1. Re:This shows the weak spot of C++ by Gumpu · · Score: 2, Interesting

      It's not so much a problem of C++ as a problem of the sloppyness of the programmer. Keep track of all the new and deletes in C++ is difficult. However GC, as found in Java, is not a magic bullet.

      It is possible to leak memory in Java too (by making circular structures).

      Even worse, because objects stay around until the last reference to it is gone, it is possible to have several copies of the same object lying around. This can lead to very hard to find errors.

      For instance:

      An object A might contain a reference to object B.
      An object A2 might also contain a reference to object B, but to an older version. (Due to update error or so).

      You think they both point to the same object B, and use A and A2 accordingly. Your program will not crash, because both references point to a valid object, but it won't function correctly either. It might fail only after a very long time, due to other errors that are induced by this error. This will make it very hard to find the error.

      Have fun,
      Frans.

    2. Re:This shows the weak spot of C++ by Otis_INF · · Score: 2

      It's not a magic bullet as in 'take this pill and you're free of trouble!', but it's a great start to finally do something about it.

      What I find fascinating is that when it comes to the lack of help provided by C++ for the programmer, the frase 'but it's the sloppy programmer!' comes up a lot as the possible reason why programs written in C++ have memleaks and other crappyness.

      This is totally a proof a lot of people are 'in denial'. True, memory leaks are possible in Java and f.e. also in .NET (CLR boxing stuff can lead to memleaks, albeit small), but most developers using these platforms like Java and .NET will not create code that can lead to a memleak or buffer overflows, stackcorruption, memory corruption etc.

      C++ forces the developer to create EXTRA code to make it run perfectly (i.e.: without memleaks, stack corruption etc). To me, that's fine when there is no other choice (read: technology isn't on a level where a RTE can be fault tolerant and fault preventing) but in 2002, technology IS at that level where RTE's will make sure developers don't make mistakes and languages using these RTE's are nowadays able to provide a working environment for the developer where that developer doesn't have to write that EXTRA code to make the logic run correctly, that's already in place, provided by the language/compiler combo and / or the RTE.

      Perhaps C++ will get extended to meet those requirements, but I fear a lot of those self-called 'Elitists' now using C++ will not use these extra features simply because (according to them) then 'everybody' can use C++ and thus C++ will 'degrade' to a language of choice for the 'average' programmer, not stay a divider of who's good and who's not.

      --
      Never underestimate the relief of true separation of Religion and State.
  61. Re:Where have you been?(wasRe:x86 VM) by j3110 · · Score: 2

    Implementations are NOT good. Take the top compilers used today, (Intel's, MS VC++, GCC, Borland) and see how many programs compile on all of them! This is precisely why it's a failure. ISO/ANSI itself is a failure because there are relatively no standards that they have produced that have been followed such that code is portable.

    GC that isn't at least a compile time option (preferably a run-time option), is useless to those who actually need it. One spec implementation is worth a hundred good other implementations. Reasons: 1) Not tied to different licences. 2) All compilers will support it on all platforms. 3) It would actually be used where needed.

    In the example that you site as a good place for native GUI's is the most ignorant arguement I've seen on slashdot to date. Not even Java promised that you wouldn't have to rewrite the GUI for PDA's. (Don't quote hype, find a trusted source where SUN claimed you could run the same code on a PDA) The GUI's are fundamentally different in that case. The look AND the feel of the program should be customizable by the user. That is the promise of Java's LNF. You can choose native if you want, but the LNF is seperate from the code, therefore, you don't have to rewrite the GUI to make it look or feel different. The user ultimately should decide how the program behaves. Any arguement to the contrary is ridiculous.

    http://www.iso.ch/iso/en/aboutiso/annualreports/ 20 01/index.html
    excuse me but I think the fact that they have a financial statement is enough proof that they are a for profit entity. Though ANSI is nonprofit, the only real spec they are known for is the one that causes my ls to be colorful :) At least it seems to be the only one that stuck. Besides, if the ANSI standard was so hard to implement, one could argue that the tools used to implement it where inferior. Just think about that one for a moment.

    This loss of control as you would call it is what ensures that my program will run on ANY Java runtime environment. Can you say that your C/C++ code will compile on ANY C/C++ compiler??? Don't be so ignorant to ask SUN to destroy something good. They have a JCP that decides the fate of Java, and SUN makes sure that it is implemented properly or not at all. If SUN wasn't in control, C# would have been J++ and not a single thing SUN or the JCP would have done could have mattered. SUN has and is making it possible for open source implementations of Java to be certified. Have you not been reading the Apache-Sun conversations? Soon there will be free test suites for nonprofit and open source implementations of the Java specs. Not that you can't implement the spec all you want, you just can't say it's certified if it isn't. You can create uncertified open source java all day, Apache and JBoss has been doing it for years. You can derive it to be whatever you want. You just can't call it certified until it passes the tests. I only wished C/C++ was like that. That alone would be enough that I would still be using it. There's the difference that SUN sees between ISO/ANSI and the JCP.

    C++ was a great technology and may be again someday and still has it's place, but that doesn't excuse your ignorance about the JCP/SUN.

    --
    Karma Clown
  62. Re:If you're worried about threading/memory bugs by 10Ghz · · Score: 3, Funny

    0wn3d!

    --
    Lesbian Nazi Hookers Abducted by UFOs and Forced Into Weight Loss Programs - -all next week on Town Talk.
  63. Re:C/C++? by Anonymous+Brave+Guy · · Score: 2
    What is this pedantry regarding "C/C++"?

    It's an attempt by those who understand the languages to stop the propagation of the myth that they are somehow inherently related such that a comment about one necessarily applies to the other. The two languages look superficially similar, and indeed for some time C++ was almost a superset of C. However, idiomatically, they are used quite differently, and there are now significant features in each language that are absent in the other.

    The vast majority of comments I see where someone writes "C/C++", they really mean one of "C" or "C++", and they are trying to arbitrarily extend an argument inappropriately using proof by hand-waving. It has been noted by many pedants who object to this use that writing "C/C++" is almost surely a sign that you don't know one or other, and so far, I have yet to see many people breaking that rule.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  64. No debug cycle by Per+Abrahamsen · · Score: 2
    I used valgrind for a heavy numeric program, and while it took hours to run even a simple test case, I don't consider it much of a problem given the alternative. Tracking down memory errors can take days and is extremely frustrating.

    Valgrind is a program I run if I suspect a memory error, and maybe every half year just to feel safe. It is used a lot less than the debugger, as memory errors are far less common than logical errors, at least for me. But when I need valgrind, it is godsend.

    And of course, the really cool thing about valgrind is that it takes no human time to use. You just type

    valgrind yourprogram -your arguments
    in some terminal window, and go back to working on something else. No special compile or build options, or any manual intervention needed. When it is finished, maybe next day, you read the problem repport.
  65. Re:What's the fun in that? by ajs · · Score: 2

    Debugging problems that you're aware of is one thing, and yes I just print status messages to find that kind of problem most of the time too. Memory checkers are more useful for finding the kinds of bugs that you don't know are there. It's a sanity check, if you will. If you run one, and it doesn't find anything, all the better!

  66. Re:Market for commercial programming tools for Lin by Wumpus · · Score: 2

    True, but searching freshmeat for "profiler" doesn't bring up your project. OProfile does show up, though, so I guess most people don't go any further.

  67. Re:If you're worried about threading/memory bugs by affenmann · · Score: 2

    If you're worried about threading/memory bugs, you rather want to compile ML or HASKELL to a blazingly fast 100% native-code binary, without ever using non-free software.

    Java's type system still allows wrong type casts, which can only be checked at runtime, and this gives essentially memory bugs. I wish Java had a better type system with proper polymorphism (like Generic Java) instead of these ugly casts to Object and back...

  68. Re:What's the fun in that? by Greg+Lindahl · · Score: 2


    I said nothing of the sort. I have tried many debuggers, and the reason that I debug with print statements is that it works. I do a lot of parallel and distributed programming; I don't make a lot of elementary mistakes when I program.

    Please stop jumping to conclusions so quickly.

  69. Re:C/C++? by Anonymous+Brave+Guy · · Score: 2
    Ummm... wasn't the first C++ "compiler" just a preprocessor that converted the code to C?

    Yes, it was. And do you know how long ago that was, and how much the languages have both changed since then?

    Also, those who are familiar with one are often familiar with the other, even if they have a strong preference for one over the other.

    Those who are familiar with one often think they're familiar with the other, and draw false conclusions based on assumptions of similarity. This is exactly the reason why people who are genuinely familiar with both languages often dislike the use of "C/C++".

    I would never say "my code is written in C/C++" I have no problem putting "C/C++" on a resume, talking to employers who are looking for someone with skills in "C/C++", or making arguments about "C/C++" vs. Java.

    Sorry, but I don't think the term "C/C++" is useful in any of those situations. If you have skills in C and/or C++, say so. Writing "C/C++" suggests that you've learned some hybrid out of a Schildt book and don't actually know the difference. As for making arguments comparing "C/C++" with Java, I'm afraid that's just silly. C, C++ and Java have syntactic similarities, but C and C++ are no more similar than C and Java or C++ and Java.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  70. Re:Buy a faster computer? by WNight · · Score: 2

    I agree. Perhaps let developers perform compiles on a very fast remote box, but make them use and test the system on a computer that is the "minimum recommended". If they can't do it, the stated minimums are wrong.

  71. Re:C/C++? by Anonymous+Brave+Guy · · Score: 2
    It doesn't matter what you or I think. The PHBs say "C/C++" so when I speak with them I use it too.

    The good PHBs don't. In fact, I judge (with considerable accuracy so far, I might add) the competence of those who interview me for jobs based on precisely this sort of detail. If I come across a company where the staff conducting a technical interview or running the projects don't know the difference (or -- another favourite -- think JavaScript and Java are somehow the same thing), I run away as fast as I can.

    And in response to your other reply...

    That C and C++ most certainly *are* more similar to eachother than they are to Java. If you can't see how, I think you're a poser.

    No, I'm an experienced programmer with knowledge of all three and a different opinion. Calling me names won't change that.

    C is fundamentally a procedural language. While it can host OO and generic programming approaches, it provides no particular support for them. OTOH, for the low-level bit-twiddling approach, there's nothing to beat it. It is very much characterised by the use of compact, precise code.

    Java is the equivalent but for OO: it can do procedural and (when the generics finally arrive in routine use) generic, but OO is its only real forte. The emphasis in typical Java programming -- though this is probably more to do with what it's used for than any inherent limitation in the language -- is much more in stringing together bits of the vast standard library it ships with than in low-level bit-twiddling.

    C++ can surely do procedural or OO, but at its best it is characterised by the use of complementary procedural and OO approaches, with generics allowing some very helpful techniques in supporting that mix.

    To me, these languages have obvious parallels in syntax, but in style, they are all worlds apart. What is it that you think is more similar in C and C++ than the links between C and Java or C++ and Java?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  72. Re:C/C++? by Anonymous+Brave+Guy · · Score: 2

    I guess the thing is that you're looking at the programming and run-time environment, where clearly Java is very different to any completely compiled language, whereas I'm looking at the programming style, where C, C++ and Java are all quite different.

    To me as a developer, the former might sway my decision about which language to use, but is otherwise irrelevant; I could take a C++ guy familiar with classes and OO design, teach him Java's minor syntactic differences and let him go, and he'd be producing results. Of course, the difference between that guy and a skilled Java programmer is (mostly) the latter's knowledge of a few Java idioms and its standard library.

    In contrast, you cannot take a good C programmer, show him a couple of minor syntactic changes and a command-line switch, and turn him into a good C++ programmer. The difference in programming idioms -- whole paradigms, even -- is much greater. OTOH, of course, C++ inherits much of C's standard library, and he could continue to use that until he was up to speed with the C++ equivalents, and when to use each.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.