-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Noticed by @xiangfan-ms.
_STL_VERIFY expands to _STL_REPORT_ERROR which expands to _CRT_SECURE_INVALID_PARAMETER:
Lines 186 to 194 in aa5145c
| #define _STL_VERIFY(cond, mesg) \ | |
| do { \ | |
| if (cond) { /* contextually convertible to bool paranoia */ \ | |
| } else { \ | |
| _STL_REPORT_ERROR(mesg); \ | |
| } \ | |
| \ | |
| _Analysis_assume_(cond); \ | |
| } while (false) |
Lines 167 to 171 in aa5145c
| #define _STL_REPORT_ERROR(mesg) \ | |
| do { \ | |
| _RPTF0(_CRT_ASSERT, mesg); \ | |
| _CRT_SECURE_INVALID_PARAMETER(mesg); \ | |
| } while (false) |
For _DEBUG mode, C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt\corecrt.h defines:
#define _CRT_SECURE_INVALID_PARAMETER(expr) \
::_invalid_parameter(_CRT_WIDE(#expr), __FUNCTIONW__, __FILEW__, __LINE__, 0)__FUNCTIONW__ can be a very long string. Interestingly, it doesn't appear to be used by the assertion dialog:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: C:\Temp\meow.exe
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.29.30129\include\array
Line: 171
Expression: cannot increment value-initialized array iterator
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
I wonder whether we could change _STL_REPORT_ERROR to behave like _CRT_SECURE_INVALID_PARAMETER except passing an empty string for the function name; this might reduce the size of debug-mode binaries by a noticeable amount.
Reactions are currently unavailable