Thread overview
[Issue 8537] New: Warnings page is outdated
Aug 11, 2012
Maxim Fomin
Aug 13, 2012
Don
Sep 02, 2012
Maxim Fomin
August 11, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8537

           Summary: Warnings page is outdated
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody@puremagic.com
        ReportedBy: maxim@maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-08-11 12:07:22 PDT ---
Page http://dlang.org/warnings.html seems to be outdated:
It states, that 'length' inside array subscript denotes array's length and that
compiler adds assert(0) after loops. However, following code

import std.stdio;

void main()
{
    char[10] a;
    int length = 4;
    writeln(a[length-1]);
}

int bar(int k, int[] Collection)
{
    foreach(int x; Collection)
    {
        if (x == k)
            return x+1;
    }
}

int foo(int i)
{
    return i;
    return i + 1;
}

generates errors:

hello.d(7): Error: ScopeDsymbol hello.__anonymous.__anonymous.__anonymous using
'length' inside [ ] is deprecated, use '$' instead
hello.d(7): Warning: array 'length' hides other 'length' name in outer scope
hello.d(10): Error: function hello.bar no return exp; or assert(0); at end of
function
hello.d(22): Warning: statement is not reachable

It indicates that parts dealing with 'length' and assert(0) need be removed from http://dlang.org/warnings.html.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 13, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8537


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2012-08-13 08:23:44 PDT ---
Incidentally the 'implicit conversion' warning section is out-of-date too.
The statement:
"D follows the C and C++ rules regarding default integral promotion in
expressions."
should be clarified with a mention of D's range propagation, which dramatically
reduces the number of false alarms.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8537


Maxim Fomin <maxim@maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from Maxim Fomin <maxim@maxim-fomin.ru> 2012-09-02 07:06:37 PDT ---
Pull request was accepted, issue is closed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------