DMD: Finding symbol value references to enable more move optimizations in parameter passings

2016-09-27 Thread Nordlöw via Digitalmars-d
I'm currently trying to understand if it's possible to add more move-optimizations in parameter passing for those parameters whole symbols aren't used after the call or for `const` or `immutable` parameters to `@safe pure` (strictly pure) functions. This similar to function cal

Re: Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Steven Schveighoffer
On Mon, 08 Nov 2010 14:19:47 -0500, Pillsy wrote: Steven Schveighoffer Wrote: On Mon, 08 Nov 2010 13:46:52 -0500, Pillsy wrote: > Besides, isn't catenating or appending in place impossible with D's > (immutable) strings anyway? This is a misconception, a string is not immutable, the da

Re: Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Pillsy
Pillsy Wrote: [...] > So, wait, if I have a program like this: > void appendSailor (string s) { >s ~= "Sailor"; > } > void main () { >auto s = "Hello World!"; > >appendSailor(s[0 .. 6]); > >writefln(s); > } > I should expect to get "Hello Sailor" as output? Or is it just tha

Re: Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Pillsy
Steven Schveighoffer Wrote: > On Mon, 08 Nov 2010 13:46:52 -0500, Pillsy > wrote: > > Besides, isn't catenating or appending in place impossible with D's > > (immutable) strings anyway? > This is a misconception, a string is not immutable, the data it points > to is immutable. You can appe

Re: Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Jonathan M Davis
On Monday, November 08, 2010 10:46:52 Pillsy wrote: > Jonathan M Davis wrote: > > On Monday, November 08, 2010 08:43:20 Pillsy wrote: > > > The length property of an array shouldn't be directly mutable, > > > and you shouldn't be able to append onto the end of a dynamic > > > array, because it can

Re: Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Steven Schveighoffer
On Mon, 08 Nov 2010 13:46:52 -0500, Pillsy wrote: Besides, isn't catenating or appending in place impossible with D's (immutable) strings anyway? This is a misconception, a string is not immutable, the data it points to is immutable. You can append to a string just like a mutable array.

Flexibly sized arrays (was Re: in-parameter)

2010-11-08 Thread Pillsy
Jonathan M Davis wrote: > On Monday, November 08, 2010 08:43:20 Pillsy wrote: > > The length property of an array shouldn't be directly mutable, > > and you shouldn't be able to append onto the end of a dynamic > > array, because it can cause some surprising behavior and adds a > > lot of cruft

Re: in-parameter

2010-11-08 Thread Jonathan M Davis
On Monday, November 08, 2010 08:43:20 Pillsy wrote: > Jonathan M Davis Wrote: > [...] > > > So, if you alter the elements of that array, it alters the elements of > > the array that was passed in. However, if you alter the arrays size, > > causing it to have to re-allocate memory, then that array

Re: in-parameter

2010-11-08 Thread Pillsy
Jonathan M Davis Wrote: [...] > So, if you alter the elements of that array, it alters the elements of > the array that was passed in. However, if you alter the arrays size, > causing it to have to re-allocate memory, then that array is going to > be pointing to a different block of memory, and

Re: in-parameter

2010-11-08 Thread Jonathan M Davis
On Monday 08 November 2010 00:03:55 spir wrote: > On Mon, 8 Nov 2010 18:13:54 +1000 > > "Daniel Murphy" wrote: > > "spir" wrote in message > > news:mailman.157.1289146124.21107.digitalmar...@puremagic.com... > > I'd like to know, aside user-side semantics, whether the compiler uses > > the "in"

Re: in-parameter

2010-11-08 Thread spir
On Mon, 8 Nov 2010 18:13:54 +1000 "Daniel Murphy" wrote: > "spir" wrote in message > news:mailman.157.1289146124.21107.digitalmar...@puremagic.com... > I'd like to know, aside user-side semantics, whether the compiler uses the > "in" qualifier for efficiency (pass arrays & structs by ref under

Re: in-parameter

2010-11-07 Thread Daniel Murphy
"spir" wrote in message news:mailman.157.1289146124.21107.digitalmar...@puremagic.com... I'd like to know, aside user-side semantics, whether the compiler uses the "in" qualifier for efficiency (pass arrays & structs by ref under the hood?). Well, seems obvious, but there may be some hidden con

in-parameter

2010-11-07 Thread spir
Hello, I'd like to know, aside user-side semantics, whether the compiler uses the "in" qualifier for efficiency (pass arrays & structs by ref under the hood?). Well, seems obvious, but there may be some hidden constraint I'm unable to realise. Denis -- -- -- -- -- -- -- vit esse estrany ☣ spi