Boost logo

Boost Users :

Subject: Re: [Boost-users] [test] BOOST_*_EQUAL against constants
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-07-18 21:54:18


Alexander Lamaison <awl03 <at> doc.ic.ac.uk> writes:

> I can obviously cast the 0 constant to an unsigned it but it's getting
> tedious doing this every time. Surely there must be a better way?

1. Use 0U
2. Define ULONG uzero = 0; and use it in comparisons.
3. Define your own macros which take 2 args, cast to right type one of them and
forward them to BOOST_CHECK_EQUAL.

> Is there some way to force the comparison to interpret
> constants as being of whatever type they are being compared to?

How can I know which one is constant? What is the correct type out of 2? Type of
left argument or right? I thought about automatic type promotion at some point,
but never came up with reasonable design.

Gennadiy


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