Re: null == "" is true?

2022-07-14 Thread Palak via Digitalmars-d-learn
Hi @Steven Schveighoffer, Yes solution looking useful and sure it will work. Thanks.

Re: Unable to use map() and array() inside a class-field's initializer.

2022-07-14 Thread realhet via Digitalmars-d-learn
On Thursday, 14 July 2022 at 14:41:53 UTC, Paul Backus wrote: Explicit type annotation: vvv Thank You! I will remember that in case of weird errors I can try to help the compiler with type inference.

Re: Unable to use map() and array() inside a class-field's initializer.

2022-07-14 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 14 July 2022 at 13:57:24 UTC, realhet wrote: Hello, Somehow it can't reach map and array inside a class field initializer. If I put that small expression inside a function, it works. If I encapsulate the initializer expression into a lambda and evaluate it right away, it also

Unable to use map() and array() inside a class-field's initializer.

2022-07-14 Thread realhet via Digitalmars-d-learn
Hello, Somehow it can't reach map and array inside a class field initializer. If I put that small expression inside a function, it works. If I encapsulate the initializer expression into a lambda and evaluate it right away, it also works. Only the nice form fails. Why is that? ```d import

Re: vectorization of a simple loop -- not in DMD?

2022-07-14 Thread max haughton via Digitalmars-d-learn
On Thursday, 14 July 2022 at 13:00:24 UTC, ryuukk_ wrote: On Thursday, 14 July 2022 at 05:30:58 UTC, Siarhei Siamashka wrote: On Tuesday, 12 July 2022 at 13:23:36 UTC, ryuukk_ wrote: I wonder if DMD/LDC/GDC have built in tools to profile and track performance Linux has a decent system wide

Re: vectorization of a simple loop -- not in DMD?

2022-07-14 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 14 July 2022 at 05:30:58 UTC, Siarhei Siamashka wrote: On Tuesday, 12 July 2022 at 13:23:36 UTC, ryuukk_ wrote: I wonder if DMD/LDC/GDC have built in tools to profile and track performance Linux has a decent system wide profiler: https://perf.wiki.kernel.org/index.php/Main_Page

Re: vectorization of a simple loop -- not in DMD?

2022-07-14 Thread z via Digitalmars-d-learn
On Monday, 11 July 2022 at 18:15:16 UTC, Ivan Kazmenko wrote: Hi. I'm looking at the compiler output of DMD (-O -release), LDC (-O -release), and GDC (-O3) for a simple array operation: ``` void add1 (int [] a) { foreach (i; 0..a.length) a[i] += 1; } ``` Here are the outputs: