This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[fwd] Re: GSL Design Document -- Question on abstract base class in C


From: Brian Gough <bjg@network-theory.co.uk>
Date: Thu, 14 Mar 2002 20:41:20 +0000 (GMT)
To: Van den Eynde Gert <gvdeynde@SCKCEN.BE>
Subject: Re: GSL Design Document -- Question on abstract base class in C

Van den Eynde Gert writes:
 > I've read the Design document yesterday and have a question on the
 > representation of abstract base classes in C. I'm working on a
 > small project here to solve a certain set of ODEs, in which
 > parameters in the RHS come from function evaluations.  The point is
 > that I want these functions to be general (with an 'evaluate'
 > method) and have different kinds of ways to really evaluate these
 > functions (like linear interpolation between two points, direct
 > calculation, etc). So I want an abstract base class with different
 > specialisations, but every type of specialisation has different
 > initialisation parameters (like for example the interpolation needs
 > two (x,y) couples to interpolate between). This is why I went to
 > C++, and this is the only reason why I went to C++. So if there is
 > a possibility to represent an abstract base class in C, I would be
 > very happy to use this and get rid of the C++.
 > > Could you give me some references on doing this (a paper, a >
 tutorial, a book)?

Hi,

I don't know of any elegant way to allow different initialisations for
specialisations of an abstract base class in C.  In GSL all methods
use the same arguments for initialisation for simiplicity.

Inelegant ways involve things like varargs or run-time type
identification.  I rejected those methods as too complicated.

I don't know if this is discussed in the papers of Kiem-Phong Vo et al
cited in the design document but I recommend reading those anyway.

I'm CC'ing your message to the gsl-discuss list in case anyone has any
comments there.

regards
-- 
Brian 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]