Movement against float.init being nan

mw m at g.c
Thu Oct 26 06:38:41 UTC 2023


On Thursday, 26 October 2023 at 02:42:37 UTC, Witold wrote:
> I like NaN initialization. Just like I like null initialization 
> for pointers.

Me too.

Actually, I just tried the follwing in importC, to see how dmd 
will handle the init:

``` import_c.c
#include <stdio.h>

int main() {
   int i;
   double d;
   printf("%d %f\n", i, d);
   return 0;
}

```


$ dmd import_c.c
$ ./import_c
1973916528 0.000000
$ ./import_c
1108345712 0.000000

looks like it still using the C semantics.

 From what I read "How ImportC Works": 
https://dlang.org/spec/importc.html#internals

" ... converts the C syntax into the same AST (Abstract Syntax 
Tree) that D uses".

So, I'm just wondering can we add a switch: I really want the 
ImportC will init the variable with D's semantics.

@Walter, How does this sound? :-)



More information about the Digitalmars-d mailing list