Boost logo

Boost :

From: Michel Decima (michel_decima_at_[hidden])
Date: 2004-08-31 17:38:44


I made another changes to the library source to make it works on my test
platform (Linux.x86, gcc-3.3.4 and gcc-3.4.1) :

The library compiles well with gcc-3.3.4, but gcc-3.4.1 needs some help
to find the 'read' and 'write' functions:

In file included from /Boost/src/boost/boost/io/zlib.hpp:19,
from /Boost/src/boost/libs/io/build/../src/zlib.cpp:11:
     In member function
    `streamsize boost::io::detail::symmetric_filter_adapter_impl<
         SymmetricFilter, Alloc
>::read(Source &, typename boost::io::char_type<T>::type *,
     error: `read' is not a member of `boost::io'

Same error for `write' on lines 110 and 160. The missing fuctions
are defined in the header operations.hpp, which is not included.
(see operations-hpp.patch)

The inclusions of the headers gives another problem:

In file included from
from /Boost/src/boost/boost/io/zlib.hpp:19,
from /Boost/src/boost/libs/io/build/../src/zlib.cpp:11:
/Boost/src/boost/boost/io/operations.hpp: In static
     member function
    `static void boost::io::detail::read_impl<
>::putback(T &, typename boost::io::char_type<T>::type)':
/Boost/src/boost/boost/io/operations.hpp:102: error:
     invalid application of `sizeof' to incomplete type
    `boost::STATIC_ASSERTION_FAILURE< false>'

I don't understand why this assertion fails (but I didn't tried to ;)
so I changed it to true...

The lib is now ready to be linked against, let's see some example

To compile the bzip2 example (doc section with gcc-3.4.1,
you need to define the macro BOOST_IO_NO_FULL_SMART_ADAPTER_SUPPORT
(gcc-3.3.4 does not need it).
Without this macro you get the following errors:

In file included from /Boost/stow/boost-
from /Boost/stow/boost-1.32.0/include/boost-
from /Boost/stow/boost-1.32.0/include/boost-
from simple_bzcat.cpp:4:
     error: non-template `result_type' used as template
     note: use `U::template result_type' to indicate that it is a template
     error: expected `{' before ';' token

The two builds of the program run as expected.

The gzip example (doc section fails (using gcc-3.3.4 or gcc-3.4.1)
with the errors :

In file included from simple_gzcat.cpp:6:
     error: expected unqualified-id before numeric constant
     error: expected `, ' or `;' before numeric constant
     error: declaration of `int boost::io::gzip_error::zlib_error() const'
     error: changes meaning of `zlib_error' from `boost::io::zlib_error'

The first error (line 88) : the declaration of the constant 'unix' clashes
with the platform-dependant macro 'unix' already defined by the compiler
(see boost/config/select_platform_config.hp). The attached patch
renames the constant to unix_os (not the best name, but it is not the

The second error is big collision around the name zlib_error : a class
in the namespace boost::io (zlib.hpp), a constant in the namespace gzip
(gzip.hpp) and a member function of the class gzip_error (gzip.hpp)
The patch renames the member function to lib_error, it's not
the best solution again, but it works.

After a library rebuild, the second example compiles with both
compilers, and
runs without any problems.


--- ../iostream/boost/io/gzip.hpp Tue Aug 31 23:12:01 2004
+++ boost/io/gzip.hpp Wed Sep 1 09:11:44 2004
@@ -85,7 +85,7 @@ namespace os {
 const int fat = 0;
 const int amiga = 1;
 const int vms = 2;
-const int unix = 3;
+const int unix_os = 3;
 const int vm_cms = 4;
 const int atari = 5;
 const int hpfs = 6;
@@ -135,16 +135,16 @@ class gzip_error : public std::ios::fail
     gzip_error(int error)
         : std::ios::failure("gzip error"),
- error_ (error), zlib_error_(zlib::okay) { }
+ error_ (error), lib_error_(zlib::okay) { }
     gzip_error(const zlib_error& e)
         : std::ios::failure("gzip error"),
- error_(gzip::zlib_error), zlib_error_(e.error())
+ error_(gzip::zlib_error), lib_error_(e.error())
         { }
     int error() const { return error_; }
- int zlib_error() const { return zlib_error_; }
+ int lib_error() const { return lib_error_; }
     int error_;
- int zlib_error_;
+ int lib_error_;

--- ../iostream/boost/io/operations.hpp Tue Aug 31 23:12:01 2004
+++ boost/io/operations.hpp Tue Aug 31 23:23:59 2004
@@ -99,7 +99,7 @@ struct read_impl<input> {
     template<typename T>
     static void putback(T&, BOOST_IO_CHAR_TYPE(T))
--- ../iostream/boost/io/symmetric_filter_adapter.hpp Tue Aug 31 23:12:01 2004
+++ boost/io/symmetric_filter_adapter.hpp Tue Aug 31 23:23:03 2004
@@ -41,6 +41,7 @@
 #include <boost/io/detail/config.hpp> // scope_guard.
 #include <boost/io/detail/scope_guard.hpp>
 #include <boost/io/io_traits.hpp>
+#include <boost/io/operations.hpp> // read, write
 #include <boost/shared_ptr.hpp>
 namespace boost { namespace io {

Boost list run by bdawes at, gregod at, cpdaniel at, john at