[Issue 3827] Warn against and then deprecate implicit concatenation of adjacent string literals

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 30 06:10:14 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=3827

--- Comment #36 from yebblies <yebblies at gmail.com> ---
(In reply to bearophile_hugs from comment #35)
> 
> I don't understand what you suggest me to file.

If the @nogc enforcement was done after constant folding, then that expression
wouldn't use the gc.  Same with things like `[1, 2, 3][0]`.

> A line of code "string s2 =
> "AB" ~ "CD";" performs a run-time array concatenation, that always performs
> a memory allocation, so it can't be @nogc.

Try it, look at the asm.  No memory allocation.

--


More information about the Digitalmars-d-bugs mailing list