Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/rubyPublic
Jemma Issroff edited this pageMay 30, 2023 ·2 revisions

Ruby's source code is written assuming the following. It is considered to be extremely difficult to port to an environment not satisfying (any of) them.

The Language

  • Your C compiler complies ISO/IEC 9899:1999 at least for features in "Known supported features" ofhttps://bugs.ruby-lang.org/projects/ruby-trunk/wiki/C99.
  • The "execution character set" of your C environment (cf: the standard) must be ASCII, not something like EBCDIC.
  • Your compiler should not limit user (re-)definitions of identifiers listed in the C standard library.
  • (If you choose to opt-in instruction unification feature of the VM) Your C compiler must acceptswitch statement with more than 256 branches.
  • Your C compiler must accept string literals of at least 7,000 characters.

Types

  • char must either be identical tosigned char or identical tounsigned char and nothing else.
  • char must be 8 bits long. There are a lot of places where 8 appear as magic numbers.
  • int must be 32 bits long.
  • long must either be 32 bits long or 64 bits long.
  • Fixnum's width is that oflong, not that of pointers. This is true even whenlong is smaller thanVALUE.
  • time_t must be an integer type (but signedness might vary).
  • Unsigned 32 bits integer is required for character handlings due to due to GB18030. Signed 32 bits is insufficient.
  • There must either beintptr_t, or an integer type that can be casted from/tovoid * without loss.
  • Although the standard saysenum is a signed int, there are parts in the source code whereenum andlong are assumed convertible without loss.
  • sizeof(size_t) == sizeof(void*) holds.
  • sizeof(VALUE) == sizeof(void*) holds.

Pointers / Memories

  • Eitherlong orlong long (_int64) must be convertible with pointers.
  • void * must exist.
  • Function pointers andvoid * must be convertible without loss.
  • Arbitrary function pointers must be convertible via cast to each other and can be called via casting.
  • Machine stack must exist; that is, automatic variables should be arranged in a high-order or low-order specific position of some memory address, not distributed.
  • Least significant 2 bits of pointer type values ​​must always be 0.

Floating point number

  • Infinity and NaN must exist somewhere in thedouble type.
Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp