Re: How to delete dynamic array ?

2021-03-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Thursday, 18 March 2021 at 21:21:37 UTC, Paul Backus wrote: The source code is here: https://github.com/p0nce/d-idioms/ Thanks for the answer. But it's more complex than I thought. Something like Latex was in my mind.

Re: How to delete dynamic array ?

2021-03-18 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 18 March 2021 at 18:48:26 UTC, Vinod K Chandran wrote: On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: I made this article to clear up that point: https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property Sorry for this off-topic question.

Re: How to delete dynamic array ?

2021-03-18 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: I made this article to clear up that point: https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property Sorry for this off-topic question. I am amazed with eye catchy look of that d-idioms page. I want to cr

Re: How to delete dynamic array ?

2021-03-18 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 16:20:06 UTC, Steven Schveighoffer wrote: It's important to understand that [] is just a practical syntax for a fat pointer. Thinking of [] just as a fancy pointer helps imho to clarify that the pointed to memory nature is independant of the pointer itself.

Re: question about ref keyword

2021-03-18 Thread ag0aep6g via Digitalmars-d-learn
On Thursday, 18 March 2021 at 16:59:24 UTC, Jack wrote: let's assume this class: class C { private S m_s; this() { m_s = S(30); } ref S value() { return m_s; } ref S value(ref S s) { return m_s = s;

question about ref keyword

2021-03-18 Thread Jack via Digitalmars-d-learn
let's assume this class: class C { private S m_s; this() { m_s = S(30); } ref S value() { return m_s; } ref S value(ref S s) { return m_s = s; } } and I do something like this: auto s1 = S(

Re: noobie question, dub or meson?

2021-03-18 Thread Tobias Pankrath via Digitalmars-d-learn
On Thursday, 18 March 2021 at 02:28:56 UTC, Chris Piker wrote: Hi D I've started a D layer for one of my C libraries that's adds some new functionality and a bit of an interface upgrade. In turn I'm using this combined code-base as a dependency for D "scripts". Since my software is used by

Re: rawRead from Pipe segfaults

2021-03-18 Thread kdevel via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 23:08:07 UTC, kdevel wrote: [...] How do I keep the pipe open? Having the readEnd and writeEnd closed in the parent is usually the right thing to to. spawnProcess closes the ends which is documented: | Note that if you pass a File object that is not one of the s

Re: rawRead from Pipe segfaults

2021-03-18 Thread kdevel via Digitalmars-d-learn
On Thursday, 18 March 2021 at 07:55:01 UTC, Imperatorn wrote: [...] Have you tried "scope(exit) wait(" instead? Yes. Does not make a difference. For the segfault I have filed Issue 21728

Re: rawRead from Pipe segfaults

2021-03-18 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 23:08:07 UTC, kdevel wrote: In order to watch out for lost bytes in a pipe I encountered this segfault. It seems that the readEnd is already closed when rawRead = fread is called (uncomment the eof line). [...] Have you tried "scope(exit) wait(" instead?