Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a page on String, DString, ZString #63

Open
joshring opened this issue Oct 6, 2024 · 1 comment
Open

Write a page on String, DString, ZString #63

joshring opened this issue Oct 6, 2024 · 1 comment

Comments

@joshring
Copy link
Contributor

joshring commented Oct 6, 2024

How to use each, how to use with temporary allocator

coppamocha — Today at 09:36
do we need to free Strings or are they automatically freed.
asking this cuz, i tried .free() method and the program aborts:
free(): invalid pointer
[09:37]
is this because maybe the string is allocated on stack?
[09:38]
if so, is there a way to detect if the string was allocated on stack?

Christoffer L — Today at 10:36
No, you need to know where this String comes from @coppamocha. That is one of the drawbacks of using String. You can use the DString if you want to have something that knows how to free itself.

string.iterator() iterates over codepoints, so you get Char32 back

@joshring joshring changed the title Write a page on strings, DString ZString Write a page on strings, DString ZString CString Oct 7, 2024
@joshring joshring changed the title Write a page on strings, DString ZString CString Write a page on String, DString ZString CString Oct 7, 2024
@joshring joshring changed the title Write a page on String, DString ZString CString Write a page on String, DString, ZString, CString Oct 7, 2024
@joshring joshring changed the title Write a page on String, DString, ZString, CString Write a page on String, DString, ZString Oct 10, 2024
@joshring
Copy link
Contributor Author

For additional info see: c3lang/c3c#1612

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

No branches or pull requests

1 participant