Ruby: include/ruby/internal/value.h File Reference

Ruby 3.4.6p54 (2025-09-16 revision dbd83256b1cec76c69756ecb8758b9e1079833de)

Macros | Typedefs
value.h File Reference

Defines VALUE and ID. More...

`#include "ruby/internal/static_assert.h"`
`#include "ruby/backward/2/long_long.h"`
`#include "ruby/backward/2/limits.h"`

Go to the source code of this file.

## Macros
#define | SIZEOF_VALUE SIZEOF_UINTPTR_T
| Identical to sizeof(VALUE), except it is a macro that can also be used inside of preprocessor directives such as #if.
#define | RBIMPL_VALUE_NULL UINTPTR_C(0)
| A compile-time constant of type VALUE whose value is 0.
#define | RBIMPL_VALUE_ONE UINTPTR_C(1)
| A compile-time constant of type VALUE whose value is 1.
#define | RBIMPL_VALUE_FULL UINTPTR_MAX
| Maximum possible value that a VALUE can take.

## Typedefs
typedef uintptr_t | VALUE
| Type that represents a Ruby object.
typedef uintptr_t | ID
| Type that represents a Ruby identifier such as a variable name.
typedef intptr_t | SIGNED_VALUE
| A signed integer type that has the same width with VALUE.

## Detailed Description

Defines VALUE and ID.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file value.h.

## Macro Definition Documentation

## ◆ RBIMPL_VALUE_FULL

#define RBIMPL_VALUE_FULL UINTPTR_MAX

Maximum possible value that a VALUE can take.

Definition at line 90 of file value.h.

Referenced by RB_STATIC_SYM_P().

## ◆ RBIMPL_VALUE_NULL

#define RBIMPL_VALUE_NULL UINTPTR_C(0)

A compile-time constant of type VALUE whose value is 0.

Definition at line 76 of file value.h.

Referenced by RB_FL_TEST(), and RBasic::RBasic().

## ◆ RBIMPL_VALUE_ONE

#define RBIMPL_VALUE_ONE UINTPTR_C(1)

A compile-time constant of type VALUE whose value is 1.

Definition at line 83 of file value.h.

## ◆ SIZEOF_VALUE

#define SIZEOF_VALUE SIZEOF_UINTPTR_T

Identical to sizeof(VALUE), except it is a macro that can also be used inside of preprocessor directives such as #if.

Handy on occasions.

Definition at line 69 of file value.h.

Referenced by rb_fix2str(), rb_memsearch(), and rb_uint2big().

## Typedef Documentation

## ◆ ID

typedef uintptr_t ID

Type that represents a Ruby identifier such as a variable name.

ID method = rb_intern("method");
VALUE result = rb_funcall(obj, method, 0);
rb_funcall
VALUE rb_funcall(VALUE recv, ID mid, int n,...)
Calls a method.
Definition vm_eval.c:1099
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40

Note
  rb_cSymbol is a Ruby-level data type for the same thing.

Definition at line 52 of file value.h.

## ◆ SIGNED_VALUE

typedef intptr_t SIGNED_VALUE

A signed integer type that has the same width with VALUE.

Definition at line 63 of file value.h.

## ◆ VALUE

typedef uintptr_t VALUE

Type that represents a Ruby object.

It is an unsigned integer of some kind, depending on platforms.

VALUE value = rb_eval_string("ARGF.readlines.map.with_index");
rb_eval_string
VALUE rb_eval_string(const char *str)
Evaluates the given string.
Definition vm_eval.c:2058

Warning
  VALUE is not a pointer.
  VALUE can be wider than long.

Definition at line 40 of file value.h.