Page MenuHomePhabricator

insert issue
Closed, CompletedPublic


Insert function has strange behavior. Will add characters to the string, but not in the right order, and in some cases, not the right char.


Task Type
Proposed Urgency
g2: Minor
r1: Trivial
Volatility (Caught At)
v1: Coding
o1: Coding

Revisions and Commits

Event Timeline

bdvolwiler triaged this task as p4: Now priority.Feb 4 2018, 11:01 AM
bdvolwiler created this task.

@jcmcdonald, is there any reason Scott designed this recursively? I don't fully understand the function, and it seems like this could be written simpler (albeit probably slower).

@bdvolwiler honestly, I don't know. What I do know is that Batman always said we can contact him if needed, so I'd try that. I'll send his email address to your company email.

@sataylor, if you see this, we're sending up the batsignal!

Macro _batsignal_:

Appending letters to end of OneString not currently working.
Pretty sure the error causing a random letter to be added to the string is not within the scope of this task.

To further detail the problem, when you try to insert to the end of a OneString, the correct number of letters will be added, but not the correct letters.

OneString aStr("beautif");
aStr.insert(7, "ul");

These lines should yield beautiful but instead result in beautifng.

I believe the problem lies not within insert, but in double size.

There is a note in comments that deleting the array of OneChars causes undefined behavior. This matches with the unpredictable nature of the bug.

The part of this task that was preventing "ul" from being added is completed.

For the undefined behavior portion, please refer to T1191

jcmcdonald edited projects, added PawLIB [Project]; removed Unknown Object (Project).Jan 23 2020, 1:54 PM