www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8537] New: Warnings page is outdated

reply d-bugmail puremagic.com writes:
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



---
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: -------
Aug 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8537


Don <clugdbug yahoo.com.au> changed:

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



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: -------
Aug 13 2012
prev sibling parent d-bugmail puremagic.com writes:
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



---
Pull request was accepted, issue is closed.

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