Ruby 4.1.0dev (2026-10-05 revision 3ce63c09207c704ece92c800dec01ea26b45bcb3)
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))
44
45struct st_table;
46
51struct RObject {
52
54 struct RBasic basic;
55
57 union {
58 /* Embedded instance variables. When an object slot is large enough, it
59 * uses this area to store the instance variables embedded.
60 *
61 * This is a length 1 array because:
62 * 1. GCC has a bug that does not optimize C flexible array members
63 * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
64 * 2. Zero length arrays are not supported by all compilers
65 */
66 VALUE ary[1];
67
74 } as;
75};
76
77#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:51
struct RBasic basic
Basic part, including flags and class.
Definition robject.h:54
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:73
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.