|
Boost : |
From: Daryle Walker (darylew_at_[hidden])
Date: 2000-11-22 14:11:17
on 11/22/00 11:56 AM, Andreas Scherer at as_at_[hidden] wrote:
> After applying Jeremy's fix to <boost/graph/uniform_cost_search.hpp>,
> I was able to compile an extended set of examples for both the Boost
> Graph Library and other parts of the Boost C++ Library with MSVC++
> 6.0 sp3 on WinNT 4 sp6.
>
> In order to further improve the compilability of various source
> modules of the Boost C++ Library, I applied even more system-specific
> modifications, which I would like to present in the form of a short
> patch file (gzipped and uuencoded for conclusion). Maybe the
> respective maintainers of these libraries could take a look at the
> patches and find a way to incorporate them. (Note that the patch
> file was created on WinNT, so you may have to reverse the path
> separators before you can run patch on Unix systems.)
[TRUNCATE]
I looked at the attached file, and I think some of the fixes are approached
in the wrong manner. I'm thinking of the following type:
> diff -rpw boost_1_18_3\boost\pending\stringtok.hpp
> \local\da\boost_1_18_3\boost\pending\stringtok.hpp
> *** boost_1_18_3\boost\pending\stringtok.hpp Fri Nov 03 12:53:52 2000
> --- \local\da\boost_1_18_3\boost\pending\stringtok.hpp Wed Nov 22 10:44:16
> 2000
> ***************
> *** 53,58 ****
> --- 53,66 ----
> #include <string>
> #include <cstring> // for strchr
>
> + #ifdef _MSC_VER
> + namespace std
> + {
> + inline char* strchr( const char* wstr, int c )
> + {
> + return ::strchr( wstr, c );
> + }
> + }
>
> /*****************************************************************
> * This is the only part of the implementation that I don't like.
I don't know the diff syntax that well, but I guess that you're adding a
function std::strchr that calls ::strchr. From that and the fact you used
_MSC_VER, I guess that that compiler doesn't put the C functions in the std
namespace. However, there is another #define in config.hpp made for this
problem: BOOST_NO_STDC_NAMESPACE. It's a compiler-agnostic solution, and
its blurb in the header gives a better solution than your brute-force
recalling:
> // BOOST_NO_STDC_NAMESPACE: The contents of C++ standard headers for C
> library
> // functions (the <c...> headers) have not been placed in namespace std.
> // Because the use of std::size_t is so common, a specific workaround for
> // <cstddef> (and thus std::size_t) is provided in this header (see below).
> // For other <c...> headers, a workaround must be provided in the boost
> header:
> //
> // #include <cstdlib> // for abs
> // #ifdef BOOST_NO_STDC_NAMESPACE
> // namespace std { using ::abs; }
> // #endif
On a separate note: if you're going to use attachments, do them in the
proper way. I get the daily digest version of this list, and it usually
deletes attachments. Since you did it "wrong," I saw the attachment, but my
mailer (Outlook Express 5.02/Mac) chopped off the two e-mails following
yours! (Fortunately, I could read them when I looked at the raw message.)
I wonder how many other corrections I missed by not getting attachments?...
-- Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk