Ruby 4.1.0dev (2026-10-03 revision 9b8b0ae443b38b19bcabebec450fa1ae1658cfbc)
robject.h
Go to the documentation of this file.
1#ifndef RBIMPL_ROBJECT_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_ROBJECT_H
23#include "ruby/internal/config.h"
24
25#ifdef HAVE_STDINT_H
26# include <stdint.h>
27#endif
28
32#include "ruby/internal/cast.h"
34#include "ruby/internal/value.h"
36
43#define ROBJECT(obj) RBIMPL_CAST((struct RObject *)(obj))
45#define ROBJECT_FIELDS ROBJECT_FIELDS
48struct st_table;
49
54struct RObject {
55
57 struct RBasic basic;
58
60 union {
61 /* Embedded instance variables. When an object slot is large enough, it
62 * uses this area to store the instance variables embedded.
63 *
64 * This is a length 1 array because:
65 * 1. GCC has a bug that does not optimize C flexible array members
66 * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
67 * 2. Zero length arrays are not supported by all compilers
68 */
69 VALUE ary[1];
70
77 } as;
78};
79
80#endif /* RBIMPL_ROBJECT_H */
Defines RBIMPL_ATTR_ARTIFICIAL.
Defines RBIMPL_ATTR_DEPRECATED.
Defines enum ruby_fl_type.
Defines RBIMPL_ATTR_PURE.
Ruby object's base components.
Definition rbasic.h:69
Ruby's ordinal objects.
Definition robject.h:54
struct RBasic basic
Basic part, including flags and class.
Definition robject.h:57
union RObject::@59 as
Object's specific fields.
VALUE extended
When an object slot is too small or too complex to store instance variables inline,...
Definition robject.h:76
Definition st.h:79
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40
Defines enum ruby_value_type.