[hcs-d] learning C++

Greg Price gprice at post.harvard.edu
Wed Apr 6 15:37:52 EDT 2011


On Wed, Apr 6, 2011 at 12:05, William Josephson <wkj at post.harvard.edu> wrote:
> On Wed, Apr 06, 2011 at 11:44:04AM -0700, Greg Price wrote:
>> Google uses C++ for most of their server code. They're much better off
>> than if they used C or Fortran for that purpose
>
> Fortran is for numerics, not systems.

That's right. I mentioned it because it was in the previous comparison.


>>  -- good C++ code can
>> be resistant to memory-corruption bugs in ways similar to Java or
>> Python programs. And of course it's much faster and more compact in
>> memory than an equivalent Python program.
>
> This is more or less bunk.  Some time back Brian Kernighan showed me
> a small benchmark he had written in which C++ loses pretty handily to
> Java and a number of scripting languages.  C++ is bloated and slow and
> memory corruption is still common enough.

I don't know what this benchmark is or how the C++ code in question
was written, but this is not a common result. As for memory
corruption, the way you write the code is critical. If you use
pointers and arrays the same way as you would in C, of course memory
corruption bugs are just as likely. If you systematically use
abstractions like Boost shared pointers or scoped pointers, you are
much better off in that respect.

Greg


More information about the hcs-discuss mailing list