bug-hurd
[Top][All Lists]
Advanced

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

Re: libpager multi-client support


From: Brent W. Baccala
Subject: Re: libpager multi-client support
Date: Tue, 18 Oct 2016 13:56:48 -1000

On Tue, Oct 18, 2016 at 2:37 AM, Richard Braun <rbraun@sceen.net> wrote:

From my fifteen years or so experience working in various projects with
C++ and other languages, my opinion is that C++ is never the best
choice. It makes you trade lines of code for increased complexity in
understanding and following the code. You should either go with C for
excellent control, or another higher level langguage for e.g. user
interfaces and tasks that don't require the highest performance.

My opinion is that C++ features have to be used very, very judiciously to avoid the problems you describe.  It's very easy to fall into a "C++ mindset" and try to write everything in "C++ style".  My solution has been to look at each problem and ask myself how to write the code in the simplest manner.
 
I really don't think the problem you describe would be so hard to solve
in C.

Well, let's see.  To handle arbitrary numbers of clients, we have to dynamically allocate all those queues and lists.  We have to copy them when adding new clients or removing old ones (more dynamic allocation).  To constrain memory utilization, we have detect when they're no longer used and deallocate them.

Can it be done in C?  Sure.  But following my principle of asking how to write the code in the simplest manner, this one is obvious: STL containers win.
 
    agape
    brent


reply via email to

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