www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6620] New: argument evaluation order inversed for extern(C)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6620

           Summary: argument evaluation order inversed for extern(C)
           Product: D
           Version: D2
          Platform: Other
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



version (none)
{
    extern(C) int bar(int a, int b) { return b - a; }
}
else
{
    int bar(int a, int b) { return b - a; }
}

void main()
{
    int i;
    assert(bar(++i, ++i) == 1);
}

---

I know argument evaluation order isn't really guaranteed to be left to right.
But having a reverse order for extern(C) calls is simply surprising.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 07 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6620


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |INVALID




 I know argument evaluation order isn't really guaranteed to be left to right.
It isn't guaranteed _at all_, it's undefined. I think there's already an enhancement open about defining the order of evaluation, but until that's accepted this is perfectly valid behavior by the compiler. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 07 2011