Re: [boost] Borland specific defects : new config defines?

2003-02-05 Thread John Maddock
> Most my porting to borland recently has involved a couple of new bugs
> introduced in BCB6.  Rather than testing compiler and version
> everywhere, should I instead create some BOOST_SOME_DEFECT macros in the
> borland config file and test for those instead?  If so, any suggestions
> for the macro names would be appreciated.
>
> The two defects are:
> The various std::isdigit, islower, isalnum etc. convenience functions
> will not compile.

All the issues you list are related:

Borland have badly set up STLport in Builder 6, basically they put C lib
functions in namespace std, and C++ library code in namespace stlport, and
then use:

namespace std{
using namespace stlport;
}

to import the STLport code into std.  Unfortunately it doesn't work with
function declarations, one fix is to do something like:

namespace std{
using stlport::isdigit;
using stlport::abs;
using stlport::swap;
// etc etc for each broken symbol
}

I guess we could boilerplate this and just dump it in the config system, but
that would mean that  would end up including just about
all the std headers for this compiler.  A bit heavyweight if you just want
to use scoped_ptr or something :-(

Any other ideas?

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost



[boost] Borland specific defects : new config defines?

2003-02-03 Thread Alisdair Meredith
Most my porting to borland recently has involved a couple of new bugs
introduced in BCB6.  Rather than testing compiler and version
everywhere, should I instead create some BOOST_SOME_DEFECT macros in the
borland config file and test for those instead?  If so, any suggestions
for the macro names would be appreciated.

The two defects are:
The various std::isdigit, islower, isalnum etc. convenience functions
will not compile.

The fix in this case is to simply implement the function directly via
use_facet instead
e.g:
std::use_facet >( oss_.rdbuf()->getloc() ).is(
std::ctype_base::digit, c )

[Also note in the general case it may be necessary to remove_const on
the character type]


Second problem is with the STLport implementation of the STL.  This
places all std names into the namespace _STL and uses macro-magic to
make this look like std.  Unfortunately, for reason I have not fully
determined, that magic sometimes comes up short.

Often the fix is to add a using directive:
using std::swap;
swap( a, b );

Sometimes the fix is to explicitly specify namespace _STL instead.

_STL::swap( a, b );


There are cases where either fix works, and specific cases where only
one form or the other works.


As best I can figure, these macros should be defined 
#if defined(__BORLAND__)\
 && __BORLANDC__ >= 0x0560  \
 && __BORLANDC__ <= 0x0561

In the latter case we should test that the STLport library has been
chosen as well.


Are either of these cases already covered by another existing
workaround?
Do either of these problems look familiar to users of other compilers?

[Note: I have not tested with the Kylix compiler but suspect it will
have similar issues]

-- 
AlisdairM

___
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost