-
Notifications
You must be signed in to change notification settings - Fork 0
feat(string): started on a string type #50
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
base: main
Are you sure you want to change the base?
Conversation
|
Should we go crazy and add native unicode support for our strings? https://github.com/SerenityOS/serenity/blob/master/AK/String.h |
|
Maybe we should consider to have two string types. Might be super duper janky. Having an immutable string is very useful. Yes -- for an immutable string you could just use the good ol' struct string_t {
char *data;
size_t length;
};
struct string_mut_t {
struct string_t str;
size_t capacity;
}; |
|
I agree to both statements above |
string.c
Outdated
| *(s->data + i) = *(data + i); | ||
| s->length++; | ||
| if (i++ == s->capacity) { | ||
| s->capacity *= 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bro why u change to *=2? Strings don't usually get that much bigger so it doesn't really make sense to have possibly 2x the amount of allocated memory compared to having a mear 32 bytes extra.
Started creating a string type base on the following struct:
Currently working on creating fast functions for string operations.