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

Benjamin Lutz benlutz at datacomm.ch
Sun Apr 16 14:50:16 UTC 2006


Thanks for your comments all that replied. 

So to summarize, it seems there are really no technical reasons to not use C++ 
for base system apps in FreeBSD. A quick look at /usr/src reveals a number of 
programs that do actually use C++: devd, gperf, groff and OpenSSL. The 
reasons seem to be more circumstantial or personal: the individual developer 
simply prefers to use C.

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).

I realize this is first grade flame war material, so I'll stop with language 
advocacy now. Yes, I also realize that experience and knowledge are more 
important than technical language features :) .

I've lately started spending some thought on code correctness and reliability. 
Frankly, I find the current situation appalling. All the time bugs are found 
even in very well tested software that could easily be prevented or 
statically recognized by better software construction tools. The big question 
is, of course, when those tools are available (and some are already), what 
does it take to get people to use them.

Cheers
Benjamin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-chat/attachments/20060416/94a899ab/attachment.pgp


More information about the freebsd-chat mailing list