Blitz logo

Blitz Devel :

From: Julian Cummings (cummings_at_[hidden])
Date: 2002-10-15 13:47:39


Hi Radek,

Thank you for submitting the config.h file and your brief report
on building Blitz with Borland 5.0.

> Radek Pecher wrote:
>
> Following your "Testing a compiler" instructions, I easily managed to
> install Blitz for my Borland C++ Builder 5.0 (my updated BCC32.EXE
> reports version 5.5.1) under Windows 2000 and Cygwin 1.3, so I am
> attaching the resulting CONFIG.H to this email, as you suggested.
>
> I also had to make slight changes in a couple of files, the two most
> important being the following:
>
> 1. BCB doesn't like lines like
> using T_base::data_;
> using T_base::base_;
> etc., inside the class declarations; the compilation actually results in
> a "fatal internal error". Simple commenting out of these lines prevents
> the error (only six header files seem to be affected by this).

We can protect these lines with a #ifndef for BCB, but these lines are
needed for ANSI standard compilers that enforce the name lookup rules
properly. Otherwise, the symbol data_ is not found. The BCB behavior
should be reported as a bug to Borland.

> 2. All math.functions with complex arguments in MATHFUNC.H require a
> reference to the data rather than just a copy; here is an example error
> message:
> [C++ Error] mathfunc.h(2394): E2357 Reference initialized with
> 'complex<float>', needs lvalue of type 'complex<float>'
> and the solution is simply
> { return BZ_CMATHFN_SCOPE(abs)((complex<float>&)x); }
> instead of the original
> { return BZ_CMATHFN_SCOPE(abs)((complex<float> )x); }

If you're going to make this change, you should more properly use a
const reference; that is

{ return BZ_CMATHFN_SCOPE(abs)((const complex<float>&)x); }

The conversion from "complex<float>" to "const complex<float>&"
should happen automatically. Sounds like Borland did not properly
declare their complex math functions to use const args. This is also
a compiler bug, I believe. What does BCB do with code like this:

float x = abs(complex<float>(3.0f,4.0f));

If it can't handle the temporary complex<float> value being passed to
the abs() function, that seems like a bug to me.

> Similar problem occurs in class _bz_update:
> { x = (X)y; }
> but changing it to
> { x = (X&)y; }
> causes another problem with the floating-point types, so I had to
> introduce a trait there (the default is the reference-cast which works
> for any user-defined types as well as for all integer types).

Very bizarre. Admittedly, we should be using the new-style C++
casts here to be more explicit, but why should these casts fail?

> The last comment I'd like to make here (to keep it brief) is a possible
> mini-bug (next time I will report bugs directly to the bug-report email
> address):
>
> ostream& operator<<(ostream& os, const Array<T_numtype,N_rank>& x) fails
> inside the iterator-loop when outputing tensors like 1x0x0, 1x1x0, etc.
> (not 0x0x0); a simple check on size() after outputing the tensor
> dimensions helps to possibly skip that loop (I am aware that
> 0-dim.tensors don't make too much sense and that's perhaps why you
> didn't even consider them there - but you can create them:
> Array<float,3> tnsr(1, 0, 0); ).

OK, thanks for pointing this out. Your proposed solution makes sense.

> Thanks for Blitz and good luck with its future extensions and
> improvements!
>
> Radek
>
> PS: I don't expect any reply to this email - I can imagine you get lots
> of these...

We try to be as responsive as possible, for a volunteer open-source endeavor.

Regards, Julian C.

--
Dr. Julian C. Cummings                       E-mail: cummings_at_[hidden]
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125
_______________________________________________
Blitz-dev mailing list
Blitz-dev_at_[hidden]
http://www.oonumerics.org/mailman/listinfo.cgi/blitz-dev