Share via


Compatibility and Migration (Windows Embedded CE 6.0)

1/5/2010

When compiling C++ code you may encounter C2440 compiler errors in code that compiled successfully with previous versions of the CRT.

This happens because C++ overloads of some string functions with unsafe C prototypes have been added.

The functions are memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, and wcschr. In previous versions, it was possible to pass a const string or buffer argument to any of these functions and assign its result to a non-const pointer, which could then be used to assign to the original const string. In C++, such unsafe usage of the functions is no longer allowed. To fix the errors, only assign the result of the functions to a const pointer if the argument is const. C code is not affected by this change.

Many CRT functions now validate parameters and call a handler function (_invalid_parameter_handler) if the validation fails. The default routine will report to Watson and terminate the current process. You can override this behavior with _set_invalid_parameter_handler.

See Also

Reference

Security-Enhanced CRT Functions for Windows Embedded CE

Concepts

CRT Security Enhancements

Other Resources

What's New in the C Run-Time Library