Summary: Warnings page is outdated
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites

--- Comment #0 from Maxim Fomin <> 2012-08-11 12:07:22 PDT 
Page 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;

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 no return exp; or assert(0); at end of
hello.d(22): Warning: statement is not reachable

It indicates that parts dealing with 'length' and assert(0) need be removed

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to