- Notifications
You must be signed in to change notification settings - Fork5.2k
Tiny improvement ofStringBuilder.Append(StringBuilder)#101020
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
danmoseley commentedApr 14, 2024
Worth an assert to self document? |
skyoxZ commentedApr 14, 2024
My answer would rather be no. Perhaps runtime/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs Lines 2438 to 2446 infa1164c
|
tannergooding commentedApr 18, 2024
If we're making an assumption, we should add an assert to validate that assumption holds true long term. Otherwise, it is trivially possible for a bug to be introduced due to a later refactoring or change. |
danmoseley commentedApr 18, 2024
Also relevant, in some places StringBuilder relies on use of unsafe code such that bounds mistakes could cause and in the past have caused heap corruption. It's another reason to assert assumptions a little more than you might in some other code. |
danmoseley commentedMay 14, 2024
timeouts, let's try again |
it is guaranteed that
m_ChunkLength == 0andm_ChunkChars.Length >= countafterExpandByABlock(count);.