Re: Get memory used by current process at specific point in time

2020-01-13 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 13 January 2020 at 20:08:19 UTC, Jacob Carlborg wrote: On 2020-01-12 14:58, Per Nordlöw wrote: Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process? I don't think so. But if you're on macOS you can use

Re: Invalid memory operation during allocation with `new`

2020-01-13 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 13 January 2020 at 20:30:33 UTC, Adam D. Ruppe wrote: Reading symbols from pain... (gdb) break onInvalidMemoryOperationError Breakpoint 1 at 0x4614f8 (gdb) r Starting program: /home/me/test/pain [Thread debugging using libthread_db enabled] Using host libthread_db library

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 20:53:43 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: [...] I had to set PKG_CONFIG_PATH to "/usr/local/lib/pkgconfig". For some reason Manjaro distro doesn't

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 19:56:35 UTC, p.shkadzko wrote: On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will

Re: Compilation error: undefined reference to 'cblas_dgemv' / 'cblas_dger' / 'cblas_dgemm'

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 12 January 2020 at 13:07:33 UTC, dnsmt wrote: On Saturday, 11 January 2020 at 16:45:22 UTC, p.shkadzko wrote: I am trying to run example code from https://tour.dlang.org/tour/en/dub/lubeck ... This is Linux Manjaro with openblas package installed. The Lubeck library depends on

Re: Invalid memory operation during allocation with `new`

2020-01-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 13 January 2020 at 09:34:42 UTC, Per Nordlöw wrote: Without finding any potential problems. Any other suggestions on how to trace this problem? Run the program in a debugger with the `--DRT-trapExceptions=0` argument to the program with certain versions of druntime, or set a

Re: Get memory used by current process at specific point in time

2020-01-13 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-01-12 14:58, Per Nordlöw wrote: Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process? I don't think so. But if you're on macOS you can use Instruments (shipped with Xcode) and pick the Allocations

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 17:14:29 UTC, p.shkadzko wrote: On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _not_ auto-download required software for you. You have to

Re: Fetching an element using find

2020-01-13 Thread lithium iodate via Digitalmars-d-learn
On Monday, 13 January 2020 at 17:58:57 UTC, Steven Schveighoffer wrote: On 1/13/20 12:47 PM, H. S. Teoh wrote: Why not write your own convenience wrapper? auto firstElement(R)(R r) if (isInputRange!R) { if (r.empty) throw new Exception(...);

Re: Fetching an element using find

2020-01-13 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 13, 2020 at 12:58:57PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: > On 1/13/20 12:47 PM, H. S. Teoh wrote: > > > > Why not write your own convenience wrapper? > > > > auto firstElement(R)(R r) > > if (isInputRange!R) > > { > > if

Re: Fetching an element using find

2020-01-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/13/20 12:47 PM, H. S. Teoh wrote: Why not write your own convenience wrapper? auto firstElement(R)(R r) if (isInputRange!R) { if (r.empty) throw new Exception(...); return r.front; } auto e = myData.find!(e

Re: Fetching an element using find

2020-01-13 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 13, 2020 at 12:39:30PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote: > I have a range (array), I want to find an element and get it from that > array. > > The code I'm writing looks like this: > > auto answer = arr.find!((item,x) => item.id == x)(id); >

Fetching an element using find

2020-01-13 Thread Steven Schveighoffer via Digitalmars-d-learn
I have a range (array), I want to find an element and get it from that array. The code I'm writing looks like this: auto answer = arr.find!((item,x) => item.id == x)(id); enforce(!answer.empty, "id not in the range"); auto realAnswer = answer.front; I can't do find(id).front, because that

Re: books for learning D

2020-01-13 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jan 13, 2020 at 04:23:19AM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 1/13/20 2:28 AM, mark wrote: > > I'm just starting out learning D. > > > > Andrei Alexandrescu's "The D Programming Language" is 10 years old, > > so is it still worth getting? (I don't know how much D has

Re: How to create meson.build with external libs?

2020-01-13 Thread p.shkadzko via Digitalmars-d-learn
On Sunday, 12 January 2020 at 22:12:14 UTC, Rasmus Thomsen wrote: On Sunday, 12 January 2020 at 22:00:33 UTC, p.shkadzko wrote: [...] In difference to dub, meson will _not_ auto-download required software for you. You have to ways to go forward with this: [...] I followed the 1 step,

Re: books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
On Monday, 13 January 2020 at 16:37:31 UTC, Ron Tarrant wrote: Actually, Andrei's book has been updated a few times over the years since first being published. The latest version says this on the copyright page: D version: 2.081.1 Book revision: 2018-10-17 So, it's really only about 14

Re: books for learning D

2020-01-13 Thread Pavel Shkadzko via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Start with "Programming in D" by Ali:

Re: books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
On Monday, 13 January 2020 at 16:45:46 UTC, mark wrote: On Monday, 13 January 2020 at 16:37:31 UTC, Ron Tarrant wrote: Actually, Andrei's book has been updated a few times over the years since first being published. The latest version says this on the copyright page: D version: 2.081.1 Book

Re: books for learning D

2020-01-13 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Actually, Andrei's book has been updated a few times

Re: Invalid memory operation during allocation with `new`

2020-01-13 Thread Steven Schveighoffer via Digitalmars-d-learn
On 1/13/20 4:34 AM, Per Nordlöw wrote: On Sunday, 12 January 2020 at 17:36:23 UTC, Adam D. Ruppe wrote: Of course that doesn't help the case when you don't know the rule and don't even think to call it... Thanks. I checked and @nogc-qualified all the class destructors defined in my

Re: books for learning D

2020-01-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:58:51 UTC, mark wrote: Both those books are published by Packt who normally have no quality control at all as I've discovered to my cost. I found working with Packt to be difficult on a lot of levels too. Like chapter 1 of my book had various symbols mangled

Re: books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
Thanks for all the comments. Look's like I'll be buying Mike's "Learning D"!

Re: books for learning D

2020-01-13 Thread René Heldmaier via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) I found the book amazing. It not only explains the

Re: books for learning D

2020-01-13 Thread Mike Parker via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:58:51 UTC, mark wrote: Both those books are published by Packt who normally have no quality control at all as I've discovered to my cost. However It's hit and miss in my experience. I've picked up some utter crap from them, but I've also found some real

Re: Tour: unneeded import

2020-01-13 Thread drug via Digitalmars-d-learn
On 1/13/20 3:11 PM, drug wrote: On 1/13/20 2:45 PM, mark wrote: In the D tour example shown here https://tour.dlang.org/tour/en/basics/ranges there is the following import: import std.range : drop, generate, take; But generate is not used so I think it ought to be deleted to avoid confusion.

Re: books for learning D

2020-01-13 Thread Ali Çehreli via Digitalmars-d-learn
On 1/13/20 2:28 AM, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Yes, Andrei's book is dated but it offers a great perspective on D and

Re: Tour: unneeded import

2020-01-13 Thread drug via Digitalmars-d-learn
On 1/13/20 2:45 PM, mark wrote: In the D tour example shown here https://tour.dlang.org/tour/en/basics/ranges there is the following import: import std.range : drop, generate, take; But generate is not used so I think it ought to be deleted to avoid confusion. done -

Re: books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:35:51 UTC, bachmeier wrote: On Monday, 13 January 2020 at 11:20:31 UTC, mark wrote: On Monday, 13 January 2020 at 11:13:32 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48

Tour: unneeded import

2020-01-13 Thread mark via Digitalmars-d-learn
In the D tour example shown here https://tour.dlang.org/tour/en/basics/ranges there is the following import: import std.range : drop, generate, take; But generate is not used so I think it ought to be deleted to avoid confusion.

Re: books for learning D

2020-01-13 Thread bachmeier via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:20:31 UTC, mark wrote: On Monday, 13 January 2020 at 11:13:32 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei

Re: books for learning D

2020-01-13 Thread bachmeier via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:20:31 UTC, mark wrote: On Monday, 13 January 2020 at 11:13:32 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei

Re: books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:13:32 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years

Re: books for learning D

2020-01-13 Thread IGotD- via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Andrei Alexandrescu's is still a good read for those

Re: books for learning D

2020-01-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 13 January 2020 at 11:08:45 UTC, Ferhat Kurtulmuş wrote: On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed

Re: books for learning D

2020-01-13 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Monday, 13 January 2020 at 10:28:48 UTC, mark wrote: I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.) Depending on your background:

books for learning D

2020-01-13 Thread mark via Digitalmars-d-learn
I'm just starting out learning D. Andrei Alexandrescu's "The D Programming Language" is 10 years old, so is it still worth getting? (I don't know how much D has changed in 10 years.)

Re: Invalid memory operation during allocation with `new`

2020-01-13 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 12 January 2020 at 17:36:23 UTC, Adam D. Ruppe wrote: Of course that doesn't help the case when you don't know the rule and don't even think to call it... Thanks. I checked and @nogc-qualified all the class destructors defined in my project. Without finding any potential