Udostępnij za pośrednictwem


/Zc:wchar_t (wchar_t Is Native Type)

When specified, the type wchar_t becomes a native type that maps to __wchar_t in the same way that short maps to __int16. /Zc:wchar_t is on by default.

/Zc:wchar_t[-]

Remarks

If /Zc:wchar_t- is specified, the compiler requires you to either define wchar_t or to include one of the many header files that defines it (for example, wchar.h). Typically, wchar_t is defined as an unsigned short.

With /Zc:wchar_t, the compiler recognizes wchar_t as a native type. See Data Type Ranges for more information about wchar_t.

__wchar_t is always available.

By providing overloads for both the unsigned short and __wchar_t variations of wchar_t, you can create libraries that can easily be linked with code compiled with or without /Zc:wchar_t and avoid the need to provide two different builds of the library (one with and one without /Zc:wchar_t enabled).

When /Zc:wchar_t is specified, _WCHAR_T_DEFINED and _NATIVE_WCHAR_T_DEFINED symbols are defined; see Predefined Macros for more information.

Explicit references to comsupp.lib, either from the comment pragma or via the command line, should be changed to now use either comsuppw.lib or comsuppwd.lib, as /Zc:wchar_t is now on by default. comsupp.lib should still be used when compiling with /Zc:wchar_t-.

For more information about conformance issues with Visual C++, see Compatibility and Compliance Issues in Visual C++.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Modifying Project Settings.

  2. Click the C/C++ folder.

  3. Click the Language property page.

  4. Modify the Treat wchar_t as Built-in Type property.

To set this compiler option programmatically

See Also

Reference

/Zc (Conformance)