Thread overview
[Issue 12789] Add -transition=nan to emit floating-point variables default-initialized to NaN
May 23, 2014
Andrej Mitrovic
May 23, 2014
Andrej Mitrovic
May 24, 2014
Walter Bright
May 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/3573

--
May 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc

--- Comment #2 from bearophile_hugs@eml.cc ---
I suggest something better: a compiler switch like "-fromc" that helps porting C/C++ code to D. Such flag warns against NaNs, about large fixed-size variables passed by value, and cases like this that have a different meaning in C and D:

int *x, y;

And related matters.

--
May 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

--- Comment #3 from bearophile_hugs@eml.cc ---
>about large fixed-size variables

I meant fixed-size arrays.

--
May 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
(In reply to bearophile_hugs from comment #2)
> I suggest something better: a compiler switch like "-fromc" that helps porting C/C++ code to D. Such flag warns against NaNs, about large fixed-size variables passed by value, and cases like this that have a different meaning in C and D:
> 
> int *x, y;
> 
> And related matters.

I think we added `-transition` specifically to allow fine-grained control of these diagnostics. You can always add support to a build tool like DUB where --fromC would pass in things like a hypothetical "-transition=carrays", "-transition=cpointers", etc.

--
May 23, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

--- Comment #5 from bearophile_hugs@eml.cc ---
(In reply to Andrej Mitrovic from comment #4)

> I think we added `-transition` specifically to allow fine-grained control of these diagnostics.

Right, sorry, I forgot.

--
May 24, 2014
https://issues.dlang.org/show_bug.cgi?id=12789

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|---                         |WONTFIX

--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> ---
As mentioned in the pull request, issues like these are properly in the domain of a lint-like utility, not the compiler.

--