Why is not more FreeBSD software written in C++?

John Baldwin jhb at freebsd.org
Mon Apr 17 14:48:38 UTC 2006


On Sunday 16 April 2006 10:50, Benjamin Lutz wrote:
> Why did I even ask the question? I perceive correctness as a big problem when 
> programming in C. It is difficult to know for sure that a C program is 
> correct, since there are no guards against mistakes like string buffer 
> overflows, erroneous pointer handling or memory allocation. C++ is of course 
> far from being a golden bullet, but it does solve some of the problems (using 
> C++ strings instead of char* generally means you don't have to worry about 
> string buffer overflows).

To be honest, if you want a "safer" language, I'd prefer going from C to
C# or Java.  C++'s syntax is, quite frankly, clunky in several places.
At work I recently described C# generics as "C++ templates that don't
suck" for example. :)

Also, many of the bugs I either have myself or run into in other people's
code come from the programmer not taking into account all of the conditions
(i.e. missing an edge case in implementation or design), and those type of
bugs are not something a language is going to solve.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-chat mailing list