With 160 views, I am surprised that only SARG has responded.
SARG wrote:Should we get the same result ? that's the question.
To my mind we should get the same result and angros47's second code is failing.
SARG wrote:the string chr(0) alone is considered as an empty string.
In the manual's description of String we have: "Despite the use of the descriptor, an implicit NULL character (Chr(0)) is added to the end of the string, to allow passing them to functions in external libraries without making slow copies. FreeBASIC's internal functions will ignore this character, and not treat it as part of the string."
In which case, angros47's first code is failing.
Looking at the asm produced by gas the two asms are different, but I am not an expert at asm. Concatenation is used in both asms but it is not clear to me why the first code is not 'ditching' the Chr(0); or SARG's third code for that matter.
If we have a large string comprising many substrings using Chr(0) as a delimiter, then the second code will not do as we expect it to. Parsing the large string for Chr(0) will fail because they have been ripped out.