Blitz logo

Blitz Devel :

From: Tom Hilinski (tom.hilinski_at_[hidden])
Date: 2003-01-14 17:55:15


I am in the process of porting blitz++ 0.6 to the Borland C++ Builder 6
patch 2 compiler. Several issues have come up which are not specific to the
Borland compiler (and some others that are, but I won't discuss them here.)
Some are minor, a couple of others are significant.

With the changes I've made, most of the tests I've tried in the examples and
testsuite directories run ok. For some ofthe programs which don't run, I
don't know if the code is correct or not, and haven't taken the time to
debug them (e.g., testsuite/qcd.cpp).

I now have a config.h and a set of BCB6 project files should any want them -
I'll be glad to send them along.

Issues I've fixed include the following:

---------------
(1) blitz.h
Modified the following to undef for use in MS Windows until Windows threads
are implemented.

#ifdef BZ_THREADSAFE
 #if defined(__WIN32__) || defined(_Windows) || defined(__CONSOLE__)
  // Microsoft Windows threads: not implemented
  #undef BZ_THREADSAFE
  #undef BZ_THREADSAFE_USE_PTHREADS
 #else
  // use pthreads.h
  #define BZ_THREADSAFE_USE_PTHREADS
 #endif
#else
 // not thread-safe
 #undef BZ_THREADSAFE_USE_PTHREADS
#endif

---------------
(2) memblock.h
Commented out the extraneous include of pthreads (inclusion should be
controlled in only place - e.g., blitz.h):

// already handled in blitz.h
// #ifdef BZ_THREADSAFE
// #include <pthread.h>
// #endif

---------------
(3) vector.h, veciter.h
Implemented several operators and Vector::end().
Built a test program to try them out.

---------------
(4) examples/ and testsuite/
Modified some of the examples as necessary for them to work correctly: e.g.

  examples/matmult.cpp
    original:
      A = 1.0f / (i+j-1);
    new:
      A = 1.0f / blitz::cast<float>(i+j-1);

---------------

Issues I feel are significant and should be addressed include the
following:

(1) Use of the C assert macro and stdlib exit() lead to memory leaks since
destructors are not necessarily called. These should all be replaced by
throw. (We have an macro to replace assert which throws an exception, and
can give this to the blitz project, if wanted.)

(2) Remove the directive "using namespace std" in the header file blitz.h.
As you know, in order to maintain control over namespaces, "using namespace"
usually should never be placed in a header file. Rather, each implementation
file should be allowed to define the scope that is active within that file.

(3) Replace "cout" and "cerr" with stream object references defined at
runtime. If the blitz library is used in a program in which cout and cerr
are not captured, then the output is never seen. A GUI is typical example in
which the output stream usually is not cout or cerr, but one provided by
the GUI to capture the output and write it to a window.

Well, its easy to suggest lots of work for other folks, though since my
group appears to be very interested in Blitz++, I may do some these my
self - our timeline is very short (sigh). Please send along any suggestions
you care to regarding these issues.

Tom Hilinski

Natural Resource Ecology Laboratory
Colorado State University
E-mail: Tom.Hilinski_at_[hidden]