← Back to team overview

kicad-developers team mailing list archive

Re: BOM support


On 08/06/2010 12:26 PM, Lorenzo Marcantonio wrote:
> On Fri, 6 Aug 2010, Brian F. G. Bidulock wrote:
>> Looking at the code I can see that a lot of people have
>> been "programming on their hands and knees" in C++.
>> Most of it is C code fed at a C++ compiler.
> I've seen qsort around instead of std::sort. Also the custom list
> classes instead of std containers. But you also have to think about the C++ 
> status when kicad was designed at first (it was a DOS program right?
> then no std namespace, even).

Hey don't criticize those linked list classes!  They are now world
class.  The std linked list constructs require two memory allocations
per node.  It is possible that we can write code here as well or better
than anywhere else,   It's actually possible.  You don't have to take a
back seat or defer to somebody else's idea unless you know it is
superior.  The wheel we had was replicated everywhere.  We did not
reinvent the wheel, it was laying around the yard everywhere.  I just
fixed the one we had.

Relative to doubly linked lists:
 By deriving major structures from a node, you can allocate the node in
one memory allocation.  There is no easy way to do that using std linked
list strategies, it requires two allocations per node.

Moving forward, boost::ptr_vector is a nice construct. 

(You should have seen the linked list stuff before I wrapped it up into
an API.  It was being done inline within the code.  And there were
places where a doubly linked list element was not even being put fully
onto the list, only partially.  This actually caused your knees to get
scuffed! )