Re: VS 2005 warning C4996
On 6/4/07 2:35 PM, in article f41lvl$87l$1$830fa7a5@news.demon.co.uk, "News
Admin" <news@news.demon.net> wrote:
If I call std::copy using my own back inserter...
std::copy(first,past,myBackInserter);
...VS 2005 (sp1) issues a warning, against this line of
code, saying the third parameter may be unsafe.
Is this standard compliant behaviour on the part of
VS 2005?
Wouldn't a better question to ask (at least with regards to this program's
correctness) is whether this call to std::copy() complies with the C++
Standard? Given that the compiler warns about the call, the answer is
"probably not."
As for the warning itself: the C++ Standard allows a compiler to issue
warnings about whatever it likes - and generally the number, accuracy and
helpfullness of a C++ compiler's set of warnings is considered one measure
of its quality.
So instead of questioning the propriety of the warning, I would fix the
mistake in the code. After all, when a compiler warns that a call "may be"
unsafe, it is really saying (in a sugar-coated manner) that the call -is-
unsafe.
Greg
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]