Project

General

Profile

C99 usage guideline

From Ruby 2.7, we require C compiler to support C99 features that work on environments supported by platforms maintainers.

General rule

  • C99 features that cannot be built on Travis/AppVeyor/RubyCI are prohibited.
    • Ruby 2.7 requires Visual Studio 2013+, which is tested on AppVeyor and RubyCI.
    • Ruby 2.7 requires Oracle Developer Studio 12+ or GCC on Solaris 10+, which are tested on RubyCI. (adding 12.4 and/or earlier is pending, but planned)

Known supported features

Here is a list of features that are known to work on both Visual Studio 2013 and Oracle Developer Studio 12.5, confirmed by this c99.c.

This is just for a quick reference to bypass testing on CI, and you do NOT need to update this list to use your favorite C99 feature as long as it works on Travis/AppVeyor/RubyCI.

  • // comments
  • mixed declarations and code
  • designated initializers
  • compound literals
  • relaxed constraints on aggregate and union initialization
  • trailing comma allowed in enum declaration

See also:

Discussions

  • stdbool.h seems to have been added in Oracle Solaris Studio 12.3, so we need to use missing/stdbool.h header for Oracle Solaris Studio 12.2 or earlier, which is included in our internal.h. See r66739.
  • restrict keyword does not exist on Visual Studio 2013, but __restrict exists and is used instead.
  • Switching va_copy definition like r62220 was problematic for cross compiling and removed in r62463.
    • r62191 was initially introduced for old Visual Studio. We may be able to just use va_copy with Ruby 2.7's Visual Studio 2013 requirement.

Known missing features