|
Boost : |
From: Samuel Krempp (krempp_at_[hidden])
Date: 2002-01-25 12:16:15
On Thu, 2002-01-24 at 03:09, rogeeff wrote:
> You misused BOOST_NO_CV_SPECIALIZATIONS. It does not fit here.
right.
I read the config.hpp macros explanations too fast, and mistook
'specialisations' and overloads..
> This time it was even tougher. Major isuue!!! MSVC can't resolve %
> manip(..). Ambiguity. So I was not able to compile everything.
that's due to my missuse of the macro.
I'll simply use #ifndef BOOST_MSVC now.
BTW, my T& / const T& overloads may seem unnecessary, so I wrote a few
lines showing the issue involved
http://groups.yahoo.com/group/boost/files/format2/passing_args.cpp
(A reference to this example along with a few explanations of what it
means in the context of Boost.format will be added to choices.html)
I'll keep the T& / const T& solution in general, but for MSVC :
only operator%( T const& ) for arguments
(it's ok. no copying involved, but requires a const operator<<, which
some user types may not have. )
For manipulators, the function manip will be
template<class T> manip_wrapper<T> manip(T x);
which (safely) assumes all manipulators are copyable.
> > Particularly, I'm not sure the
> > friend std::basic_ostream<Ch, Tr>&
> > operator<< <Ch, Tr> ( std::basic_ostream<Ch, Tr>& , const
> basic_format&
> > );
> > is accepted by VC++. (I replaced '<>' by '<Ch, Tr>')
> Nope. You will need to ifdef.
okay.
> 1. str still need to be fully qualified.
using boost::format::str;
is accepted by the compiler, but then :
str( ... )
is not found ? this is a strange bug of MSVC..
can you try if
using namespace boost::format;
solves that ?
> 2. _fwd header should not contain any internals.
true, I'll move the internal forward declarations in an appropriate
header.
> 3. include return 0 in all your main() bodies.
right
> 4. include != 0 where you implicitely cast from int to bool.
Why ? This implicit conversion is defined by the standard, and I prefer
bool internal = fl & std::ios_base::internal;
to :
bool internal = (fl & std::ios_base::internal) != 0;
> 5. I still does not work properly
as far as I can tell, it looks like the formatting in MSVC's stream
library is slightly not conforming to the standard.
In fact gcc's stream also is not completely conforming either, but for
more trickier cases like
cout << internal << setw(10) << setfill('Z') << "0xTrap!";
wich prints : "Trap!ZZZÜø" (the 2 last chars are random, surely buffer
overrun)
instead of "ZZZ0xTrap!"
(I reported this bug, and was told it was now fixed in gcc's CVS)
> I uploaded fixed version in vault area under format2 directory.
> Compare and you will see all my changes. Let me know when you done
> and I will remove it.
Thanks for your corrections. I've downloaded your files and looked at
all the diffes, you can remove it.
I'll make a choice for the syntax this weekend (documenting in depth
both the syntax and the reasons of the choice)
and then send you a preview of the code, if you agree to test-compile it
once again.
(the MSVC compiler that I can finally access is unfortunately not
updated with SP5, and fails on many more points than yours, so I can not
check the MSVC compatibility myself)
-- Samuel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk