Re: Choosing the correct compiler version

2022-07-20 Thread Alexander Zhirov via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 23:19:28 UTC, jfondren wrote: Finding an old version that works on your machine will be very easy, but for example the random 2016 build that I grabbed was also too old to build dmd master, so you want to prefer a newer build that still works. It's not necessary to

Re: Working with arrays (flatten, transpose, verfify rectangular)

2022-07-20 Thread ag0aep6g via Digitalmars-d-learn
On 20.07.22 11:18, anonymouse wrote:     d     auto isRectangular(A)(A a) if (isArray!A)     {     bool result;     size_t length = a[0].length;     foreach (e; a) {     result = e.length == length;     }     return

Re: null == "" is true?

2022-07-20 Thread Antonio via Digitalmars-d-learn
On Wednesday, 20 July 2022 at 13:35:14 UTC, Kagamin wrote: On Tuesday, 19 July 2022 at 18:05:34 UTC, Antonio wrote: In a relational database, `NULL` is not the same that `""`... and `NULL` is not the same that `0`. Are semantically different and there are database invariants (like foreign

Re: "Memory allocation failed" on big array

2022-07-20 Thread urned utt via Digitalmars-d-learn
Big thank. Switch to /bin64 and now works until full memory using.

Re: "Memory allocation failed" on big array

2022-07-20 Thread ryuukk_ via Digitalmars-d-learn
My guess is you are compiling to 32bit and the GC tries to reserve >4gb wich it can't, therefore out of memory Compiling to 64bit with: `dmd -m64 -run test.d` works no problem

"Memory allocation failed" on big array

2022-07-20 Thread urned utt via Digitalmars-d-learn
Hello. having about 6 Gb free RAM, trying to execute: ```d string[] dic; for (int i = 0; i < 100_000_000; i++) { dic ~= "just a word number "~to!string(i); if (i%1_000_000 == 0) { writef("processed line %s: %s\n", format("%,3d", i), format("%,3d",

Re: Working with arrays (flatten, transpose, verfify rectangular)

2022-07-20 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 20 July 2022 at 09:18:29 UTC, anonymouse wrote: Given an array of arbitrary dimensions, I would like to accomplish three things: 1) verify that it is rectangular (e.g. all elements have the same length, all sub-elements have the same length, etc.) 2) flatten

Re: Expanding CTFE code during compilation

2022-07-20 Thread Dennis via Digitalmars-d-learn
On Wednesday, 20 July 2022 at 00:33:06 UTC, Azi Hassan wrote: Where did you find it though ? I checked dmd --help and man dmd before making this thread, but to no avail. It was implemented as an internal debugging tool, not a documented feature: https://github.com/dlang/dmd/pull/6556 It

Re: null == "" is true?

2022-07-20 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 18:05:34 UTC, Antonio wrote: In a relational database, `NULL` is not the same that `""`... and `NULL` is not the same that `0`. Are semantically different and there are database invariants (like foreign keys) based on it. Trying to "mix" this concepts in a

Re: Choosing the correct compiler version

2022-07-20 Thread kdevel via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 23:19:28 UTC, jfondren wrote: Thanks for your thorough presentation. [...] Another option is to get newer glibc onto this system (not installing it, just making it available for dmd. use LD_LIBRARY_PATH). On older systems the dynamic loader (ld.so) may not

Working with arrays (flatten, transpose, verfify rectangular)

2022-07-20 Thread anonymouse via Digitalmars-d-learn
Given an array of arbitrary dimensions, I would like to accomplish three things: 1) verify that it is rectangular (e.g. all elements have the same length, all sub-elements have the same length, etc.) 2) flatten and return the flattened copy 3) transpose and return

Re: null == "" is true?

2022-07-20 Thread Antonio via Digitalmars-d-learn
On Tuesday, 19 July 2022 at 16:55:39 UTC, Kagamin wrote: As I understand, in your scenario there's no difference between null string and empty string, they both work like empty string, and D treats them as empty string. That's what I mean when I said that distinction between null and empty