|
Boost Users : |
From: John Maddock (john_at_[hidden])
Date: 2006-01-26 12:00:27
> The code below throws up warnings. Removing the min() call from
> main, or
> changing a, b and c's type to anything else (e.g. short) gets rid of
> the
> warnings.
Oh this just sucks !
I think I know what the problem is, and I've complained to MS before about
this to no avail. If you have a bunch of overloaded functions like this:
foo(short);
foo(int);
foo(long);
foo(long long);
and you call foo with a ptrdiff_t as an argument, then even though the call
is always safe (because there is always a correct overload, no matter what
the width of ptrdiff_t) then you get a C4244 warning. It happens a lot if
you try and send a size_t or ptrdiff_t to an iostream for example. In this
case instantiating std::min<int> before the regex code sees it, means that
the compiler sees an already instantiated function that takes an int as
argument, and so issues the spurious conversion warning. I've no idea why
your workaround works, but I've just applied it in a bunch of places to the
regex code. Of course there are probably an infinitely sized set of similar
gotcha's just waiting to trap the unwary.
Thanks for the report,
John.
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