Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Conversation

@krocard
Copy link
Contributor

@krocard krocard commented Feb 4, 2015

"my number " + 5 does not produces "my number 5" but rather "mber ".
If the number was greater than len(string) + 2
(pointing to the \0 and one past the end in authorized, more in UB)
the result would have been undefined behaviour.

Concatenate the number with a string stream.

@krocard
Copy link
Contributor Author

krocard commented Feb 4, 2015

👍
@dawagner @makohoek

@krocard krocard force-pushed the fix_string+num_concat branch 2 times, most recently from c424890 to 78f76a3 Compare February 4, 2015 10:25
`"my number " + 5` does not produces `"my number 5"` but rather `"mber "`.
If the number was greater than `len(string) + 2`
(pointing to the \0 and one past the end in authorized, more in UB)
the result would have been undefined behaviour.

Transforme the number to std::string using toString.

Signed-off-by: Kevin Rocard <kevin.rocard@intel.com>
@krocard krocard force-pushed the fix_string+num_concat branch from 78f76a3 to b80adac Compare February 16, 2015 10:51
dawagner added a commit that referenced this pull request Feb 18, 2015
Fix pointer arithmetic instead of concat
@dawagner dawagner merged commit 17bacca into intel:master Feb 18, 2015
@krocard krocard deleted the fix_string+num_concat branch February 20, 2015 14:15
@dawagner dawagner added the bug label Jun 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants