www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11657] New: Pass array literal to typesafe variadic argument on stack

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

           Summary: Pass array literal to typesafe variadic argument on
                    stack
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu


--- Comment #0 from Martin Nowak <code dawg.eu> 2013-12-01 10:09:12 PST ---
cat > enh.d << CODE
void foo(int[] ary...)
{
}

void bar()
{
    foo([1, 2, 3, 4]);
}
CODE

Currently this allocates a temporary array on the heap.
But because it's not allowed to escape variadic arguments, they array can be
passed on the stack.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2013
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11657


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2013-12-01 10:33:56 PST ---
(In reply to comment #0)

I think this optimization should be implemented only after the "scope"
attribute works well enough, see comment 14 in Issue 5212 .

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