Microsoft's C language policy (was: [PATCH 0/1] Add a test balloon for C99)
flat view
From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-11-30 20:52:28
On Sun, Nov 14 2021, brian m. carlson wrote: [Replying to this tidbit in the v1 CL, which isn't in the V2 one]
Unfortunately, Microsoft for many years refused[1] to support C99 in MSVC, and still does not officially do so. However, they recently added support for C11 and C17, which are sufficient for modern programming. These require a newer version of MSVC, including an updated SDK. The SDK update is available for download free of charge, and most public CI systems have support for both the updated MSVC and the SDK update. Even for users who would like to target an older version of Windows, such as the no longer supported Windows 7, GCC and Clang are available. The LLVM suite, including Clang, is available pre-compiled for download free of charge. Using a different compiler is specifically proposed by Microsoft staff[1] as a solution for users who wish to build modern programs for MSVC versions which do not support modern C. As such, we can assume that Git can be safely compiled with C99 or C11 support on all operating systems which receive security support, and even some which do not. Our CI confirms that this series passes all tests. Let's introduce a test balloon which checks for this support and fails with an error message if it is absent. [0] The reader will note that there are people working professionally in this industry who were not yet born at the time C99 was ratified. Thus, this occurred quite a long time ago indeed. [1] https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/
I hadn't seen that blog post before I'd read it when going over your series. I'd assumed that Microsoft was just dragging their feed on C language support, but that post indicates (from what seems to be as official of a source as anyone's going to get) that they're intending to not support C at all, but just some pseudo-C that happens to be a convenient subset of C++. However that post is from 2012, and you indicate that they've since added (full?) support for C11 and C17. So is this "policy" of supporting some arbitrary subset of C++ at all current as far as MSVC today goes? Aside: I just remembered we had a (seemingly abandoned) effort to get git's sources to compile with a C++ compiler[1], which would be another possible way forward to using more modern C features that happened to overlap with C++. Another one would be some sort of coccinelle-powered refactoring or other source pre-processing... 1. https://lore.kernel.org/git/20180129223728.30569-1-bmwill@google.com/ (local)