-
Notifications
You must be signed in to change notification settings - Fork 5.4k
C99 Usage Guidelines
Jemma Issroff edited this page May 30, 2023
·
1 revision
From Ruby 2.7, we require C compiler to support C99 features that work on environments supported by platform maintainers.
- 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)
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:
- 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.
-
r62191 was initially introduced for old Visual Studio. We may be able to just use
- Visual Studio 2013
- variable length arrays
_Complex
- snprintf
- some format specifier behaviors:
- size_t length modifier: %z
- infinite/indefinite/NaN conversion of floating point number
According to the header files committed in https://github.com/ruby/ruby/pull/2991,
We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.
- Developer How To, Developer How To JA
- How To Contribute
- How To Report, How To Report JA
- How To Request Backport
- How To Request Features
- Developers Meeting