All platforms: yes
All compilers: no.

Most are just toy compilers, some are special (tcc)
https://en.wikipedia.org/wiki/List_of_compilers#C_compilers

In terms of which "mainstream" compilers FULLY support a C standard greater than C89, all of GCC, Clang, and I think Intel's oneAPI DPC++ / C++ Compiler also. But not MSVC.

The default standard for Intel is C89 https://software.intel.com/content/www/us/en/develop/articles/c99-support-in-intel-c-compiler.html

It doesn't appear that you can set the standard granularly for MSVC,
https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-160
(except with Linux https://docs.microsoft.com/en-us/cpp/linux/prop-pages/c-cpp-linux?view=msvc-160 )

But you can force C89 everywhere:
https://docs.microsoft.com/en-us/cpp/build/reference/za-ze-disable-language-extensions?view=msvc-160
With the caveat: https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-160#c-standards-support-1
>  It isn't possible to specify strict C89 conformance.

Also, AFAIK, C99 isn't fully implemented by MSVC. My reference for this is an in the docs for an older MSVC version, which is why I disclaim "AFAIK":
https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)?#c11-core-language-features-c99
https://docs.microsoft.com/en-us/previous-versions/hh567368(v=vs.140)?#c99-__func__-and-preprocessor-rules

When I write C code I like to ensure it is properly portable. Insofar as it's possible, the behaviour should be identical no matter the compiler, target OS, or host OS.

Also I like to compare historic and current innovations, e.g., swapping out the malloc implementation, and profiling dis/advantaged result.

Finally from an FFI perspective there are advantages in targeting C89, so that you can guarantee interoperability with the lowest version of whatever language is calling into C. Additionally the latest version (July 2020 release) of CFFI—a popular one for Python—doesn't support all of C99, but guarantees support for all of C89.

That is why I target C89.

Samuel Marks
Charity | consultancy | open-source | LinkedIn


On Thu, Jan 14, 2021 at 4:02 PM Andreas Schneider <asn@cryptomilk.org> wrote:
On Tuesday, 12 January 2021 01:56:38 CET Samuel Marks wrote:
> Cool, I might just do that. Yeah I know C89 is a bit extreme, but to ensure
> proper portability to OpenBSD, FreeBSD, NetBSD, Windows, Linux, macOS, and
> illumos, using C89 seems to be the path of least resistance.

All of the platforms you mention here support C99 ...