Boost logo

Boost :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-01-17 02:44:05


Martin wrote:
> Michael Walter <michael.walter <at> gmail.com> writes:
>
>>But this will not fix the potential bug it's warning about.
>>
>>Michael
>
>
> Not sure how it works in VC8 but in VC7 there were several false warnings.
>
> one example:
>
> cout << size_t(100) << endl;
>
> will give you a warning because the "unsigned int" overload is used to output
> the value. This could be a problem if size_t is 64 bits.

This does not produce a warning on my msvc-7.0, 7.1 or 8.0 with -Wp64
and -W4. The Wp64 option is for pointer conversions. Consider:

int * p = 0;
cout << size_t( 0 ) << endl; // ok: integral value
cout << size_t( p ) << endl; // warning: pointer value

main.cpp(7) : warning C4244: 'argument' : conversion from '__w64
unsigned int' to 'unsigned int', possible loss of data

This is used because Win32 programming uses a lot of casts between
integers and pointers (e.g. for message argument passing).

Regards,
Reece


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