So i've upgraded one of my structs to use the more flexible
delegates instead of function pointers but when the member
function tries to access the struct's members, the contents are
random and the program fails.
i've isolated the problem by adding writefln calls before calling
the delegate a
On 2/17/21 10:38 AM, z wrote:
So i've upgraded one of my structs to use the more flexible delegates
instead of function pointers but when the member function tries to
access the struct's members, the contents are random and the program fails.
i've isolated the problem by adding writefln calls
On Wed, Feb 17, 2021 at 03:38:00PM +, z via Digitalmars-d-learn wrote:
> So i've upgraded one of my structs to use the more flexible delegates
> instead of function pointers but when the member function tries to
> access the struct's members, the contents are random and the program
> fails.
Yo
On Wednesday, 17 February 2021 at 17:45:01 UTC, H. S. Teoh wrote:
I.e., the following is NOT a good idea:
struct S {
void delegate() member;
this() {
member = &this.impl;
}
private void impl();
On Wednesday, 17 February 2021 at 19:42:00 UTC, tsbockman wrote:
On Wednesday, 17 February 2021 at 17:45:01 UTC, H. S. Teoh
wrote:
I.e., the following is NOT a good idea:
struct S {
void delegate() member;
this() {
member = &this.i
On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus wrote:
On Wednesday, 17 February 2021 at 19:42:00 UTC, tsbockman wrote:
A copy constructor and opAssign can be used to update pointers
that are relative to &this:
https://dlang.org/spec/struct.html#struct-copy-constructor
Unfortu
On Wednesday, 17 February 2021 at 20:44:46 UTC, tsbockman wrote:
On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus
wrote:
On Wednesday, 17 February 2021 at 19:42:00 UTC, tsbockman
wrote:
A copy constructor and opAssign can be used to update
pointers that are relative to &this:
ht
On Thursday, 18 February 2021 at 08:29:48 UTC, kinke wrote:
On Wednesday, 17 February 2021 at 20:44:46 UTC, tsbockman wrote:
On Wednesday, 17 February 2021 at 20:18:53 UTC, Paul Backus
wrote:
[...]
That bug is about postblits, this(this), not copy
constructors: this(ref typeof(this)). Copy c
On Thursday, 18 February 2021 at 11:00:50 UTC, vitamin wrote:
opPostMove
https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1014.md can solve this problem but it isn't implemented;
IIRC opPostMove has been abandoned for the same reason postblits
were abandoned (issues with type-check
On Thursday, 18 February 2021 at 08:29:48 UTC, kinke wrote:
Nope, Paul is right, the copy ctors don't solve anything in
this regard. Simplest example I could come up with:
https://run.dlang.io/is/TgxyU3
I found that example very confusing, as it does not contain an
explicit copy constructor,
10 matches
Mail list logo