bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ in inetutils?


From: Jeff Bailey
Subject: Re: C++ in inetutils?
Date: Mon, 22 Apr 2002 09:33:40 -0700
User-agent: Mutt/1.3.28i

On Mon, Apr 22, 2002 at 06:15:16PM +0200, Alfred M. Szmidt wrote:

> > The problem is that I'd really like to have an OO interface to the
> > SNMP modules.  Radar is being coded primarily in C++, so it's a
> > good fit.

> And what is wrong with C for this purpose?

You've asked two questions.

What's wrong with C for the SNMP library?  Nothing really.  If I had a
strong good reason for doing this piece in C++, I wouldn't have asked
what others thought. =)

Why am I using C++ for Radar?  Mostly so that I can use language
constructs to easily group object data together in a strongly typed
way.  I'm going to use composite and visitor patterns [0] to have a
generic 'node' pointer all over the place.

> > We have traditionally stuck to C for inetutils.  Since we've
> > recently declared that we don't actively support some of the
> > weirder targets (like CRAY), is it acceptable to use C++ for
> > certain applications/libraries?

> I don't know, are there any good technical reasons over picking C++
> instead of C? I.e. Is there anything that you cannot do in C but you
> can do in C++?

The three that I generally think of are:

1) Compiler-enforced user defined types.  C tends to force you into
using void pointers once you start to get a little bit clever.  C++
apps done right have essentially no casts in then.

2) Templates.

3) Language-supported notation for OO thinking.  GCC has some
"features" like nested functions that help with grouping functions and
data together.  Instead C++ has these capabilities natively.

[0] If you're not familiar with design patterns, the book I'm using
for reference is http://hillside.net/patterns/DPBook/DPBook.html.  I
can try and answer any questions you have, just send them to be
privately.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]