在 2023/7/16 00:59, Christian Franke 写道:
According to https://en.cppreference.com/w/c/chrono/localtime C11 added optional gmtime_s() and localtime_s() which conflict with the long standing MSVCRT/UCRT variants. I have no idea why they did this (C23 finally adds the traditional *_r() functions which are IIRC older than POSIX).
I have some questions about this request: 1) This patch seems to propose overloaded `localtime_s()` in C++. However wouldn't they conflict because `extern "C"` functions can't be overloaded? 2) How many projects are there which expect those Annex K functions? AFAICT when targeting Linux or BSD people generally expect the POSIX one, and for Windows they expect the Microsoft one; in neither world has the C11 one gained wide acknowledgement. UCRT is only officially documented as C99 [1] with some C11 extensions e.g. `_Alignas` and 'stdalign.h'; some parts are missing or non-conforming. 3) The macro `__STDC_LIB_EXT1__` doesn't seem to belong in 'time.h'. Ideally there should be a general macro in '_mingw.h'; then here arises another question: Should we add Annex K functions as how it is proposed now: adding stuff piece by piece, expecting other people to test it in their projects which seems quite unlikely to me, and assuming it's free of bugs because nobody has reported any? That doesn't sound good. [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/compatibility?view=msvc-170 -- Best regards, LIU Hao
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
