Re: A question about postblit constructor

2019-11-06 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Wednesday, 6 November 2019 at 09:19:04 UTC, Jonathan M Davis wrote: DIP: https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1018.md It looks like the release that added copy constructors to the compiler was 2.086 back in May: https://dlang.org/changelog/2.086.0.html

Re: A question about postblit constructor

2019-11-06 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 5, 2019 5:09:15 AM MST Ferhat Kurtulmuş via Digitalmars-d-learn wrote: > On Tuesday, 5 November 2019 at 12:06:44 UTC, Ferhat Kurtulmuş > > wrote: > > On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: > >> On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 12:09:15 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 12:06:44 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: [...] I meant the

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 12:06:44 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: [...] I meant the example as an answer to your statement, "I wonder how new memory is

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 11:20:47 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: [...] I meant the example as an answer to your statement, "I wonder how new memory is

Re: A question about postblit constructor

2019-11-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:32:03 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: [...] Yep, it is obvious that my code is wrong. s1 and s2 point to the same memory

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: On Tuesday, 5 November 2019 at 08:47:05 UTC, Ferhat Kurtulmuş wrote: value of int which is 0. I wonder how new memory is allocated without an explicit malloc here. Sorry for this noob question in advance, I could not find any

Re: A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 10:31:05 UTC, Ferhat Kurtulmuş wrote: On Tuesday, 5 November 2019 at 10:13:59 UTC, Mike Parker wrote: [...] Yep, it is obvious that my code is wrong. s1 and s2 point to the same memory address. I could obtain my desired behavior with copy constructor. The

Re: A question about postblit constructor

2019-11-05 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 5 November 2019 at 08:47:05 UTC, Ferhat Kurtulmuş wrote: value of int which is 0. I wonder how new memory is allocated without an explicit malloc here. Sorry for this noob question in advance, I could not find any doc mentioning a similar case. int* vals =

A question about postblit constructor

2019-11-05 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
I am trying to learn behavior of postblit constructor. Below code works as expected when I comment out malloc part of postblit constructor. It writes 4 if malloc part of postblit constructor is commented out. Otherwise it writes default init value of int which is 0. I wonder how new memory is