Skip to content

Conversation

Paperomo
Copy link

@Paperomo Paperomo commented Oct 4, 2025

the .cstr() function on String appears to be removed. code does not compile when used in a C++ Module. in 4.5

the .cstr() function on String appears to be removed.
code does not compile when used in a C++ Module. in 4.5
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

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

Makes sense to me. The modern version of c_str() is .utf8().get_data(), but I don't this is important in the context of format strings.

Comment on lines -57 to -60
// Converts the resulting String into a `const char *`.
// You may need to do this if passing the result as an argument
// to a method that expects a `const char *` instead of a String.
vformat("My name is %s.", "Godette").c_str();
Copy link
Member

@Calinou Calinou Oct 6, 2025

Choose a reason for hiding this comment

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

I would readd it in its current forrm, i.e. replace .c_str() with .utf8().get_data().

I know that personally, I was looking for this all the time when I started contributing to Godot 🙂 It's the same when I contribute to other open source projects in C++.

Copy link
Author

Choose a reason for hiding this comment

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

honestly I agree, since it would help with interoperability with older apis if the user so wishes to use them,

I'll go run a check if it works properly and probably push the change if the .utf8().get_data() thing works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants