3 ms·
MSVC is a very curious choice of strcpy_s implementation given that MSVC is openly not compliant with C11, much less Annex K. OpenWatcom, which implements a la
by aidenn0 5y ago
MSVC is a very curious choice of strcpy_s implementation given that MSVC is openly not compliant with C11, much less Annex K.
OpenWatcom, which implements a late draft of the standard behaves as expected on their testcase:
Runtime-constraint violation: strcpy_s, s1max > RSIZE_MAX.
ABNORMAL TERMINATION
The reason not to use the _s versions isn't that they are bad, it's that basically nobody has implemented them (hence me having to use Open Watcom to demonstrate this example)
[edit]
Just noticed that in the page they linked to at the top when they mention strcpy_s, it notes that the MSVC implementation predates even the original draft of the standard and lacks RSIZE_MAX.
- pjmlp 5y agoMSVC is compliant with C11 and C17, minus optional annexes, they are after all optional and not required for ISO compliance certification.
- aidenn0 5y agoThanks for the correction. C support in MSVC was terrible just a few years ago, but googling I see they added better C support starting in 2019