Assumptions of Ruby C source code


  • Character set of compiler is ASCII. (Not such as EBCDIC)
  • Compiler meets in principle C89.
  • The compiler does not restrict the principle use of the same identifier and C89 standard library.
  • You must be supported if there 256 or more branches of the case (if you are operand fused YARV).
  • String constant can have about 7000 characters.


  • char behave the same as unsigned char or signed char.
  • char must be 8 bit. Many places it is written in magic number and 8.
  • int type must be 32bit.
  • long is 32bit or 64bit.
  • The size of Fixnum is the width of the long rather than the width of the pointer (long may be less than VALUE, so in such case Fixnum uses only the width of the long. Including the sign bit)
  • time_t is (whether signed and unsigned) integer type.
  • A character needs 32bit (For GB18030, it needs signed 32bit)
  • enum can be converted to long without loss (enum needs be a signed int in standards)

Pointer memory

  • Pointer can be stored in long or long long(_int64).
  • it has void* type
  • Can be assigned a function pointer to void* type
  • Any function pointers can be cast from each other, and can be called through after the cast.
  • Machine stack exists; automatic variables are disposed hardens one specific portion of the lower or upper memory address, it is not dispersed.
  • The lower 2bit of the pointer type aren't used.

Floating-point number

  • C double type has NaN and Infinity