2

I try to disable a warning with the following pragma

#pragma warning(push)
#pragma warning(disable: 4996)
                std::copy(std::begin(l), std::end(l), _begin);
#pragma warning(pop)

Here, _begin is a pointer. But i continue to get the warning.

I can disable the warning in property pages, but i want to suppress it in a smallest possible scope.

EDIT:

int _tmain(int argc, _TCHAR* argv[])
{
    int i1[10];
#pragma warning(push)
#pragma warning(disable: 4996)
    copy((int*)i1, (int*)i1+10, (int*)i1);
#pragma warning(pop)

    return 0;
}

Results in:

warning C4996: 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

Yola
  • 18,496
  • 11
  • 65
  • 106

0 Answers0