Re: C++

From: Robert Collins <robertc@dont-contact.us>
Date: 04 Sep 2002 10:46:56 +1000

On Wed, 2002-09-04 at 10:00, Henrik Nordstrom wrote:
> I prefer not. I think Squid-2.X should be kept pure C.
>
> Apart from the preference of pure C I think throwing C++ into the mix
> would be too much of a mixed mess in the same program.. You would end
> up with parts using C, parts using C with a touch of OO, parts using
> C++ with a touch of C, and parts using C++ OO.. 4 differnt coding
> approaches (we have 2 today), 3 different memory allocation schemes
> (have 2 today).

The mixed mess is not a language problem IMO, it's an
abstraction/layering problem. We are violating object/struct boundaries
left right and center. Thats why I'm suggesting C++ because:
* We can start using private data.
* We can link with the existing C code.
* It's easy to incrementally convert a file at a time.

I agree we have a mess, I don't think that staying with C will let us
clean it up as easily as we could by using a language that supports the
design of squid (which is essentially object based around the cbdata'd
structs). I agree that we would have to go through a transition period.
I don't think it would be as fragmented as you paint though. We already
have many memory schemes (cbdata, cbdata overloaded to refcount (yuck),
true refcounting (devel.squid-cache.org/projects.html#refcount),
membuffers and xmalloc).
 
> Please note that there is also subtle differences in the language
> syntax, such as slightly different operator priorities.

Sure. Any one source file would be either C or C++ though, so that could
only have an impact in #defines.

Rob

Received on Tue Sep 03 2002 - 18:46:44 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:26 MST