|
Boost Users : |
From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-05-02 05:36:53
Richard Hadsell wrote:
> Richard Hadsell wrote:
>
>> Markus Schöpflin wrote:
>>
>>> - When compiling boost you will see several warnings (and one error!)
>>> about the use of assert on pointer types. These are caused by a bug
>>> in the system header files which force the argument for assert() to
>>> int. This can be fixed by editing the header file
>>> "/usr/include/assert.h".
>>
>> Thanks for the tips. With regard to this one, was your fix to (a)
>> change the cast to bool, (b) change the cast to long, or (c) just
>> eliminate the cast and let the compiler convert to bool?
As the argument to assert() is allowed to be any integral expression I
simply removed the cast to int. I filed a bug report for this and HP
acknowledged it but up to now I have no information on if or when a
fixed header will be released officially.
> Never mind. I decided to fix the assert complaints by modifying
> boost/regex/v4/perl_matcher_non_recursive.hpp. I prefer that to
> modifiying a system header on every machine and for any future upgrades
> (unlikely as they are at this point). I changed all the asserts with an
> argument of just a pointer to compare the pointer to 0, thus producing a
> valid bool. E.g.:
>
> assert(rep->next.p); => assert(rep->next.p != 0);
>
> I don't think Boost developers (i.e., John Maddock) would mind. Do you
> think they (i.e., he) might even accept this as an improvement?
I can't speak for John, you would have to ask this himself. But as that
would be a very widespread change and would affect many lines of code
(essentially every use of assert(p), where p is either a raw pointer or
a smart pointer) I don't think this would be such a good idea after all.
You could propose to add a new portability macro BOOST_ASSERT() or some
such but as far as I know the general feeling is that there are too many
such macros already.
Tru64 is the only plattform I have encountered this problem but on the
other hand, its the only 64bit plattform I have worked with so far. I
have no idea if other 64bit plattforms are affected as well.
Markus
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net