November 11, 2010 Re: Kill implicit joining of adjacent strings | ||||
---|---|---|---|---|
| ||||
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.
|
November 12, 2010 Re: Kill implicit joining of adjacent strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | 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 |
Copyright © 1999-2021 by the D Language Foundation