digitalmars.D - Re: Kill implicit joining of adjacent strings
- Sean Kelly <sean invisibleduck.org> Nov 11 2010
- Rainer Deyke <rainerd eldwood.com> Nov 11 2010
Rainer Deyke Wrote:As it turns out, the joining of adjacent strings is a critical feature. Consider the following: f("a" "b"); f("a" ~ "b"); These are /not/ equivalent.
I would hope that the const folding mechanism would combine these at compile-time. There's effectively no difference between a constant and an expression (without side-effects) that produces the same value.
Nov 11 2010
On 11/11/2010 13:37, Sean Kelly wrote:Rainer Deyke Wrote:As it turns out, the joining of adjacent strings is a critical feature. Consider the following: f("a" "b"); f("a" ~ "b"); These are /not/ equivalent.
I would hope that the const folding mechanism would combine these at compile-time.
Of course it would. That's not the issue. The issue is, is a string that's generated at compile-time guaranteed to be zero-terminated, the way a string literal is? Even if the same operation at run-time would /not/ generate a zero-terminated string? -- Rainer Deyke - rainerd eldwood.com
Nov 11 2010