Skip to content

Tutorial on how Godot uses c++ typedef #1

@jak6jak

Description

@jak6jak

In the c++ tutorial would it be possible for you to cover typedef? Most of the tutorials online cover really simple cases like: typedef int int_t; Godot sometimes uses typedef in more confusing ways that I don't think most tutorials prepare you for. An example of Godot using typedefs in a complex way is here in visual_script.h:
typedef Ref<VisualScriptNode> (*VisualScriptNodeRegisterFunc)(const String &p_type);
they later use this typedef in a Map:
Map<String, VisualScriptNodeRegisterFunc> register_funcs;
Another example is here:
typedef bool (*CompareEqualFunc)(const CallableCustom *p_a, const CallableCustom *p_b);

Can you explain how these type of typedefs work and why they are used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions