[galib] galib & BCCB 4.0
mwall at oculustech.com
Thu Jul 7 16:03:21 EDT 2005
On 07 Jul 2005, at 13:55, Leslaw K Bieniasz wrote:
> After struggling for some time with compile errors
> I have managed to create a Builder 4.0 project
> for galib, as a "library" project. I have just
i am sorry that it has been such a struggle.
> renamed all galib "c" files into "cpp" files,
does not borland have an option equivalent to the /TP option of
microsoft's vcpp compiler that treats .C files as c++ source code?
gcc has this option as well.
> and I have modified all #includes to include the
> appropriate files from the project directory.
> The project compiles with no errors, however there
> is plenty of warnings "Conversion may loose significant digits" all
> over the library. As far
> as I can see, they seem to result from rather careless lack of
> explicit casting between
> short and int types, probably also between
> int and unsigned int. My first question
> therefore is:
> (1)What to do with these warnings?
turn them off, if possible. vcpp has a pragma for this. does
borland offer anything similar? yes, the coding is a bit careless
with respect to short/int/uint. my apologies - i tried to clean them
all out, but there are a few cases where the cleanup is not trivial
(at least not if i wanted to continue supporting multiple compilers),
and i did not get around to finishing the cleanup.
> I notice that in several places in the library
> some "C" files (now changed by me to "CPP") are
> #included. I would be happy to get rid of this
> feature, as I believe this is an extremely
> bad practice in C++ to include CPP files.
> Only headers should be #included.
> My second question therefore is:
> (2) How can I eliminate these #includes?
do not eliminate them. they are there for a purpose.
it is standard practice to include a source file for template
instantiation purposes (depending on your template instantiation model).
the only place where i did some funky inclusion of source files was
with the specialization of genomes, specifically the GARealGenome and
GAStringGenome classes. the rationale is explained in the
installation page and various places in the release notes (it has
evolved over time). the usage for these are described in the
comments in that code (GARealGenome.h and GAStringGenome.h). see
ex21.C for a sample of how they are used.
the inclusion of source is an attempt to save you the coding effort
and to accommodate the behaviors of different compilers that do
> (3) In order to be able to use the library, I not
> only have to #include the "ga.h" file, but also
> which again is strange, and I am again getting
> a number of warnings
> "Conversion may loose significant digits"
> while compiling the program.
you should include GARealGenome.h only if you need that genome type
(i.e. that template specialization). see ex21.C
once again, sorry about the conversion warnings.
> (4) The compiler has a problem of identifying
> inambiguously one of the overloaded methods
> add() for the class GARealAlleleSetArray.
> The construct:
> GARealAlleleSetArray allele;
> compiles only when I define explicitly
> the parameters as float, for example:
> const float XVAL_L = -10.0;
> const float XVAL_H = 10.0;
> const float XVAL_S = 0.1;
> const float YVAL_L = -5.0;
> const float YVAL_H = 5.0;
> const float YVAL_S = 0.05;
> (5) I am using class GARealGenome,
> which as far as I can understand, is a typedef
> for ArrayAlleleGenome<float>. However, I would
> prefer to use double instead of float. But my
> attempt to instantiate ArrayAlleleGenome<double>
> produces errors in
> GARealAlleleSetArray::add() again.
> Apparently, the use of double is not possible
> in these methods.
> How can I do all calculations using double, and
> not having compile errors?
you should be able to simply copy the code from GARealGenome.[hC]
into your own source code, and replace <float> with <double>. be
sure not to replace the return types of functions such as the
see example 21 for an illustration of how to use the GARealGenome.
> (6) Is there any way of forcing the library to use
> the same sequence of pseudo-random values in every
> run? I need to do some debugging, but this impossible if at every
> run the results are different.
from the command line:
> I am ready to share my current files with anyone
> willing to help me in these matters.
i will most happily adjust the makefiles/sources of galib to
accommodate the borland compiler you are using, but i do not have it
at my disposal for testing...
More information about the galib