Boost logo

Boost :

Subject: Re: [boost] Official warnings policy?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2009-11-11 13:37:29


 -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]] On
Behalf Of
> Richard Webb
> Sent: Wednesday, November 11, 2009 4:40 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] Official warnings policy?
>
> Looks like the warnings occur depending on the types used in the unit tests.
> For example, the warning mentioned above comes from the test code:
>
> typedef variant< short, const char* > t_var2;
> typedef variant< unsigned short, const char*, t_var2 > t_var5;
> typedef variant< unsigned short, const char*, t_var5 > t_var6;
>
> t_var6 v6;
> v6 = 58;
>
> Which looks like a legitimate warning about converting an integer (58) to a
short.

Since this is expected, could the test use a static_cast to the right type?

v6 = static_cast< t_var6 >(58);

Does this quiet the warning?

Or must it be v6 = static_cast< unsigned short >(58); ?

Either way this would document that casting/converting takes place?

And perhaps users should do this too? The static_cast documents that the author
has thought about this.

Paul

---
Paul A. Bristow
Prizet Farmhouse
Kendal, UK   LA8 8AB
+44 1539 561830, mobile +44 7714330204
pbristow_at_[hidden]

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk