3 ms·
Re: getenv_s: Annex K is (still) optional. Compliant C11+ implementations may not have getenv_s.
by loeg 6y ago
Re: getenv_s: Annex K is (still) optional. Compliant C11+ implementations may not have getenv_s.
- josephcsible 6y agoThis is an understatement. The only relevant platform that supports Annex K is MSVC, and this is unlikely to change any time soon.
- loeg 6y agoAnd even MSVC does not actually implement the API specified in Annex K. Annex K was inspired by MSVC's design, but they diverged: > Microsoft Visual Studio implements an early version of the APIs. However, the implementation is incomplete and conforms neither to C11 nor to the original TR 24731-1. For example, it doesn't provide the set_constraint_handler_s function but instead defines a _invalid_parameter_handler _set_invalid_parameter_handler(_invalid_parameter_handler) function with similar behavior but a slightly different and incompatible signature. It also doesn't define the abort_handler_s and ignore_handler_s functions, the memset_s function (which isn't part of the TR), or the RSIZE_MAX macro.The Microsoft implementation also doesn't treat overlapping source and destination sequences as runtime-constraint violations and instead has undefined behavior in such cases. [0]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm