-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Fast path for handling fixed length strings? #6846
Comments
It's possible indeed and may be worthy as we transition to string view branch. |
It was a passing thought, actually while I was looking at this earlier is there any concern about accessing memory out of bounds with just Presumably like with other functions the format string would also be a good thing to know the length of. Working on a text editor as a personal project. |
Since For an empty string (IE: |
I suppose my gut instinct is because there's a missing null check that something would go wrong, but that's a different out of bounds condition than the one I was thinking of, so I almost feel silly asking. |
No worries, we all get brain farts. Dear ImGui is old school and generally doesn't explicitly check for basic mistakes like passing null for something that should never be null. |
Pushed this change with d486920 |
Was looking at text rendering code and I spotted that "%s" is specifically tested likely as a fast path for formatting text.
Was wondering if it may be worth having a fast path for the "%.*s" format. If I remember correctly the format uses an int argument first followed by a char pointer, so not that much different from "%s". I don't use c variadics much, I'm assuming something like the following works:
The text was updated successfully, but these errors were encountered: