/Zc:zeroSizeArrayNew
(Call member new/delete on arrays)
The /Zc:zeroSizeArrayNew
compiler option calls member new
and delete
for zero-length arrays of objects.
Syntax
/Zc:zeroSizeArrayNew
[-
]
Remarks
The /Zc:zeroSizeArrayNew
compiler option enables calls to member new
and delete
for zero-length arrays of objects of class types with virtual destructors. This behavior conforms to the standard. This compiler option is new in Visual Studio 2019 version 16.9 and is enabled by default in all compiler modes. Previously, in code compiled by versions before Visual Studio 2019 version 16.9, the compiler invoked global new
and delete
on zero-length arrays of objects of class types with virtual destructors.
The /Zc:zeroSizeArrayNew
option may cause a breaking change in code that relied on the previous non-conforming behavior. To restore the previous behavior, use the /Zc:zeroSizeArrayNew-
compiler option.
To set this compiler option in Visual Studio
Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.
Select the Configuration Properties > C/C++ > Command Line property page.
In Additional options, add
/Zc:zeroSizeArrayNew
or/Zc:zeroSizeArrayNew-
. Choose OK or Apply to save your changes.
See also
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho