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: nob...@puremagic.com
        ReportedBy: ma...@maxim-fomin.ru


--- Comment #0 from Maxim Fomin <ma...@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: -------

Reply via email to