Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Pretty sure that modern compilers will optimise this away, as long as the length of the string isn't changed in the loop (or declaired as
volatile
).Well, that was painfull. Not a huge fan of traps like this, but lesson learned.
SOLVED: Apparently there was an off-by-one error in the for loop reversing the words. This led to undefined chars being appended at the front of each word (probably null bytes). It seems like std::cout ignores null bytes, as it uses the length of the container class std::string to terminate that string, therefore printing it correctly.
This comment is hidden because it contains spoiler information about the solution