Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |backend --- Comment #1 from Basile-z <b2.temp@gmx.com> --- added "backend tag" b/c the suggested optim is not portable (https://dlang.org/dmd-linux.html#differences), so it's eventually only possible in the backend and for windows. on linux your clearly see that the first address is within the mapping of the running executable and not on the heap. -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|druntime |dmd -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com Component|dmd |druntime -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|druntime |dmd --- Comment #2 from Basile-z <b2.temp@gmx.com> --- the runtime does know the platform but it does not know if it has to happen to a string literal. -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 --- Comment #3 from Basile-z <b2.temp@gmx.com> --- *append -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 --- Comment #4 from deadalnix <deadalnix@gmail.com> --- How is this relevent where the memory is located? [] ~ x is x, no matter where x is located. -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 --- Comment #5 from Basile-z <b2.temp@gmx.com> --- sorry for some reasons I've read the report too fast (x ~= y) and runined it. I suggest you to close this one and open the same report again. -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dlang-bugzilla@thecybershad | |ow.net --- Comment #6 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- It would be a breaking change. ///////////// test.d ///////////// string fun() @safe { immutable char[3] arr = "foo"; string s = arr[]; string r; r ~= s; return r; } ////////////////////////////////// -- |
September 03, 2021 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 --- Comment #7 from deadalnix <deadalnix@gmail.com> --- (In reply to Vladimir Panteleev from comment #6) > It would be a breaking change. > > ///////////// test.d ///////////// > string fun() @safe > { > immutable char[3] arr = "foo"; > string s = arr[]; > string r; > r ~= s; > return r; > } > ////////////////////////////////// I don't think this is a reasonable expectation that there is duplication here. If you want it heap allocated, you ought to call dup/idup. After all, it does it the other way around: > string fun(string stuff) > { > immutable char[3] arr = "foo"; > string s = arr[]; > return s ~ stuff; > } This is all good and well, until stuff is an empty array, in which case it is not anymore. -- |
December 17, 2022 [Issue 22271] Appending to an empty array reallocate | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22271 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P4 -- |
Copyright © 1999-2021 by the D Language Foundation