Movement against float.init being nan
Dave P.
dave287091 at gmail.com
Tue Aug 23 20:44:37 UTC 2022
On Friday, 19 August 2022 at 13:42:58 UTC, Hipreme wrote:
> [...]
What’s great is that structs defined in C imported in D and
structs defined in D imported in D will have completely different
initial values despite being syntactically identical!
```D
// foo_c.c
struct Foo {
float x;
};
// foo_d.d
struct Foo {
float x;
};
// main.d
import foo_d;
import foo_c;
import std.stdio: writeln;
void main(){
foo_d.Foo f_d;
foo_c.Foo f_c;
writeln(f_d); // Foo(nan)
writeln(f_c); // Foo(0)
}
```
More information about the Digitalmars-d
mailing list