Skip to content

Conversation

@Ivorforce
Copy link
Member

@Ivorforce Ivorforce commented Nov 4, 2025

This refreshes some outdated information, and adds a few missing bits and pieces:

  • Group related headings together
  • Use GDREGISTER_CLASS instead of ClassDB::register_class (which is no longer recommended)
  • Explain other models of class privateness
    • So far, this has not been explained (afaik), and leads to regular confusion among godot-cpp users.
  • Add Object ownership and casting heading, where the different ownership models are explained.
    • So far, this has not been explained (afaik), and leads to regular confusion among godot-cpp users.

@Ivorforce Ivorforce added enhancement area:engine details Issues and PRs related to the Engine Details section of the documentation labels Nov 4, 2025
@Ivorforce Ivorforce force-pushed the object-semantics branch 3 times, most recently from b0984d7 to 4617315 Compare November 4, 2025 14:17
@Ivorforce Ivorforce requested a review from a team November 4, 2025 15:02

You should also never store ``RefCounted`` subclasses using raw pointers, for example
``RefCounted *object = memnew(RefCounted)``. This is unsafe because other owners may destruct the object, leaving you
with a dangling pointer, which will eventually result in a crash.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of repetition here with "will eventually result in a crash"

Copy link
Member Author

@Ivorforce Ivorforce Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in both sections, yes. But people may not read both.
Do you think we should rephrase one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a bit of a rephrase would be the best option

}
If the cast fails, ``nullptr`` is returned. This works the same as ``dynamic_cast``, but does not use
`C++ .RTTI <https://en.wikipedia.org/wiki/Run-time_type_information>`__.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Suggested change
`C++ .RTTI <https://en.wikipedia.org/wiki/Run-time_type_information>`__.
`C++ RTTI <https://en.wikipedia.org/wiki/Run-time_type_information>`__.

Comment on lines +342 to +344
All objects in Godot have a :ref:`_notification <class_Object_private_method__notification>`
method that allows it to respond to engine level callbacks that may relate to it.
More information can be found on the :ref:`doc_godot_notifications` page.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
All objects in Godot have a :ref:`_notification <class_Object_private_method__notification>`
method that allows it to respond to engine level callbacks that may relate to it.
More information can be found on the :ref:`doc_godot_notifications` page.
All objects in Godot have a :ref:`_notification <class_Object_private_method__notification>`
method that allows it to respond to engine-level callbacks that may relate to it.
More information can be found on the :ref:`doc_godot_notifications` page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:engine details Issues and PRs related to the Engine Details section of the documentation cherrypick:4.4 cherrypick:4.5 enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants