[Issue 15244] New: Misleading compiler warning: "Error: use .min_normal property instead of .min"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 24 15:16:50 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15244

          Issue ID: 15244
           Summary: Misleading compiler warning: "Error: use .min_normal
                    property instead of .min"
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

void main() {
    double.min;
}

Error: use .min_normal property instead of .min

I like the warning but it is misleading. When a person (especially a beginner)
writes double.min, they mean "the minimum value" but the warning tells them to
use something else: double.min_normal.

I recommend that the message be changed to something like

Error: .min is deprecated for floating point types. Do you mean -double.max or
double.min_normal?

Ali

--


More information about the Digitalmars-d-bugs mailing list