Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-08-31 20:58:42


"Michel Decima" <michel_decima_at_[hidden]> wrote in message
news:4134FDF4.1080803_at_yahoo.fr...
> Hello,
>
> 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:

<snip>

> 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)

Thanks. Funny no other compiler picked this up. I'll apply this patch as soon as
the other things are resolved (see below).

> The inclusions of the headers gives another problem:

<snip>

> /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...

Carlo explained this one. Here's the way it should be patched:

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

--- operations.hpp 1 Sep 2004 01:48:40 -0000 1.37
+++ operations.hpp 1 Sep 2004 01:48:49 -0000
@@ -19,6 +19,7 @@
 #if !defined(BOOST_NO_STD_LOCALE)
 # include <locale> // neeed for boost::io::imbue.
 #endif
+#include <boost/io/detail/assert_convertible.hpp>
 #include <boost/io/detail/dispatch.hpp>
 #include <boost/io/detail/iterator_traits.hpp>
 #include <boost/io/detail/ios_traits.hpp>
@@ -103,7 +104,7 @@

     template<typename T>
     static void putback(T&, BOOST_IO_CHAR_TYPE(T))
- { BOOST_STATIC_ASSERT(false); }
+ { BOOST_IO_ASSERT_CONVERTIBLE(BOOST_IO_CATEGORY(T), peekable_tag); }
 };

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

> The lib is now ready to be linked against, let's see some example
> programs:
>
> To compile the bzip2 example (doc section 5.9.3.3) with gcc-3.4.1,
> you need to define the macro BOOST_IO_NO_FULL_SMART_ADAPTER_SUPPORT

> error: expected `{' before ';' token

Could you try applying the following patch, and tell me if it works without
defining BOOST_IO_NO_FULL_SMART_ADAPTER_SUPPORT?

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

--- resolve.hpp 31 Aug 2004 18:02:51 -0000 1.4
+++ resolve.hpp 1 Sep 2004 01:13:32 -0000
@@ -35,7 +35,7 @@
     BOOST_STATIC_ASSERT(!is_const<T>::value);
     #ifndef BOOST_IO_NO_FULL_SMART_ADAPTER_SUPPORT
         template<typename U>
- struct get_result_type : U::result_type<Mode, Ch> { };
+ struct get_result_type : U::template result_type<Mode, Ch> { };
     #else
         template<typename U>
         struct get_result_type {

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

> The two builds of the program run as expected.
>
> The gzip example (doc section 5.9.3.2) fails (using gcc-3.3.4 or gcc-3.4.1)
> with the errors :

<snip>

> 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).

Ouch! I ran in to this with newline filter but forgot about it here. My
inclination is to get rid of the 'os' namespace and prefix each constant with
'os_'.

> The attached patch
> (gzip-hpp.patch)
> renames the constant to unix_os (not the best name, but it is not the
> question).
>
> 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.

Before I patch this, I'd like to understand the error a little better. It's hard
to see how 'zlib_error_' could clash with anything. At any rate, I don't really
care what the member variable is called, but I think I prefer
'zlib_error_code_'.

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

Thank you for all your help!!

>
> MD
>

Jonathan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk