[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: interesting links



On Thu, 2007-08-30 at 13:10 -0400, DJ Delorie wrote:
> > ... I'd say start by redesigning the data structures!  PCB could be
> > so much more "OO" even without C++.  A lot of the code would be
> > about 1/20th the size if you could just do things like
> > foo->Move(dx,dy) without having to worry about the type of foo.
> 
> You're not the first to think of that ;-)

I was wondering if we ought to avoid similar kinds of code (such as a
func pointer in each gschem/libgeda object to its drawing routine), as
its just more data to load in memory per object. Also, in that case -
the pointer conceptually belongs to gschem, but lives in libgeda.

I'm not sure what the performance hit might be in removing it, and using
a test on the object's type. I did consider it might be similarly fast
if the object's type was an integer starting from 0, (or 1) not various
ASCII chars like 'l' etc.. We could then index an array of drawing
function pointers with that type-code (after bounds testing if you
like), and de-reference the desired class function that way.

It hasn't bothered me enough to experiment with changing it yet.

Peter




_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user