Re: Unexplainable behaviour with direct struct assignment.

2022-05-19 Thread frame via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 21:49:14 UTC, HuskyNator wrote: After updating to `DMD 2.100.0` & `DUB 1.29.0`, I still get this behavior. Only when I use `dub run --b=debug` however (default for me). `dub run --b=release` does return what one would expect. I'm still on 2098.1, Windows 10 and ge

Re: Unexplainable behaviour with direct struct assignment.

2022-05-19 Thread HuskyNator via Digitalmars-d-learn
On Thursday, 19 May 2022 at 04:33:01 UTC, Tejas wrote: Does this happen with LDC as well? I tried it using `LDC 1.29.0` and it prints correctly under both `--b=release` and `--b=debug` builds.

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread bauss via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 21:52:18 UTC, HuskyNator wrote: On Wednesday, 18 May 2022 at 21:49:14 UTC, HuskyNator wrote: After updating to `DMD 2.100.0` & `DUB 1.29.0`, I still get this behavior. Only when I use `dub run --b=debug` however (default for me). `dub run --b=release` does return wh

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread Tejas via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 21:52:18 UTC, HuskyNator wrote: On Wednesday, 18 May 2022 at 21:49:14 UTC, HuskyNator wrote: After updating to `DMD 2.100.0` & `DUB 1.29.0`, I still get this behavior. Only when I use `dub run --b=debug` however (default for me). `dub run --b=release` does return wh

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread HuskyNator via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 21:49:14 UTC, HuskyNator wrote: After updating to `DMD 2.100.0` & `DUB 1.29.0`, I still get this behavior. Only when I use `dub run --b=debug` however (default for me). `dub run --b=release` does return what one would expect. I don't know if this matters either, bu

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread HuskyNator via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 20:16:51 UTC, Dennis wrote: On Wednesday, 18 May 2022 at 20:05:05 UTC, HuskyNator wrote: This will print: ``` 0 50 nan ``` Which compiler and flags are you using? For me it just prints 50, you might be stumbling on some (old) bugs in the DMD backend with floating

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread Dennis via Digitalmars-d-learn
On Wednesday, 18 May 2022 at 20:05:05 UTC, HuskyNator wrote: This will print: ``` 0 50 nan ``` Which compiler and flags are you using? For me it just prints 50, you might be stumbling on some (old) bugs in the DMD backend with floating point registers. Examples of such bugs are: https://iss

Re: Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 18, 2022 at 08:05:05PM +, HuskyNator via Digitalmars-d-learn wrote: [...] > ```d > module app; > import std.stdio; > > struct A { > float[1] vec; > this(float[1] n) { > this.vec = n; > } > } > > void main(string[] args) { > A c = A([50.0f]);

Unexplainable behaviour with direct struct assignment.

2022-05-18 Thread HuskyNator via Digitalmars-d-learn
I came across strange, seemingly non-deterministic, behaviour today. I simplified it the best I could below. I entice you to run the following piece of code. ```d module app; import std.stdio; struct A { float[1] vec; this(float[1] n) { this.vec = n; } }