Re: Referring to array element by descriptive name

2017-01-16 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 16 January 2017 at 19:03:17 UTC, albert-j wrote: Thank you for all your answers. I was concerned because I'm dealing with a small function that is called many times and where the bulk of the calculations in the simulation takes place. So even 5% performance difference would be signif

Re: Referring to array element by descriptive name

2017-01-16 Thread albert-j via Digitalmars-d-learn
Thank you for all your answers. I was concerned because I'm dealing with a small function that is called many times and where the bulk of the calculations in the simulation takes place. So even 5% performance difference would be significant for me. But it is good to know that compilers are smar

Re: Referring to array element by descriptive name

2017-01-14 Thread Ali Çehreli via Digitalmars-d-learn
On 01/14/2017 07:11 AM, albert-j wrote: > Is it possible to refer to an array element by a descriptive name, just > for code clarity, without performance overhead? E.g. > > void aFunction(double[] arr) { > double importantElement = arr[3]; > ... use importantElement ... > } > > But the abo

Re: Referring to array element by descriptive name

2017-01-14 Thread Era Scarecrow via Digitalmars-d-learn
On Saturday, 14 January 2017 at 15:11:40 UTC, albert-j wrote: Is it possible to refer to an array element by a descriptive name, just for code clarity, without performance overhead? E.g. void aFunction(double[] arr) { double importantElement = arr[3]; ... use importantElement ... } But

Re: Referring to array element by descriptive name

2017-01-14 Thread tcak via Digitalmars-d-learn
On Saturday, 14 January 2017 at 15:11:40 UTC, albert-j wrote: Is it possible to refer to an array element by a descriptive name, just for code clarity, without performance overhead? E.g. void aFunction(double[] arr) { double importantElement = arr[3]; ... use importantElement ... } But

Referring to array element by descriptive name

2017-01-14 Thread albert-j via Digitalmars-d-learn
Is it possible to refer to an array element by a descriptive name, just for code clarity, without performance overhead? E.g. void aFunction(double[] arr) { double importantElement = arr[3]; ... use importantElement ... } But the above, I suppose, introduces an extra copy operation?