Ruby  3.4.0dev (2024-11-22 revision 801e66352e698eb533c535f600d958bc1e07e75e)
Macros | Typedefs
value.h File Reference

(801e66352e698eb533c535f600d958bc1e07e75e)

Defines VALUE and ID. More...

#include "ruby/internal/static_assert.h"
#include "ruby/backward/2/long_long.h"
#include "ruby/backward/2/limits.h"
Include dependency graph for value.h:
This graph shows which files directly or indirectly include this file:

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. More...
 
#define RBIMPL_VALUE_NULL   UINTPTR_C(0)
 A compile-time constant of type VALUE whose value is 0. More...
 
#define RBIMPL_VALUE_ONE   UINTPTR_C(1)
 A compile-time constant of type VALUE whose value is 1. More...
 
#define RBIMPL_VALUE_FULL   UINTPTR_MAX
 Maximum possible value that a VALUE can take. More...
 

Typedefs

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

Detailed Description

Defines VALUE and ID.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
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.

◆ 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.

◆ 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.

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);
VALUE rb_funcall(VALUE recv, ID mid, int n,...)
Calls a method.
Definition: vm_eval.c:1099
ID rb_intern(const char *name)
Finds or creates a symbol of the given name.
Definition: symbol.c:823
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition: value.h:52
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");
VALUE rb_eval_string(const char *str)
Evaluates the given string.
Definition: vm_eval.c:1975
Warning
VALUE is not a pointer.
VALUE can be wider than long.

Definition at line 40 of file value.h.