On 10/21/13 15:04, Manu wrote:
On 21 October 2013 21:24, Denis Shelomovskij
<verylonglogin....@gmail.com <mailto:verylonglogin....@gmail.com>> wrote:

    21.10.2013 14:30, Manu пишет:

        System interface functions that pass zero-terminated strings
        through to
        the OS are the primary offender, needless garbage, those should
        be on
        the stack.

        I like to use alloca too where it's appropriate. I'd definitely
        like if
        D had a variable-sized static array syntax for pretty-ing alloca.
        I thought about something similar using alloca via a mixin
        template, but
        that feels really hackey!


    No hacks needed. See `unstd.c.string` module from previous post:
    
http://forum.dlang.org/thread/__lqdktyndevxfcewgthcj@forum.__dlang.org?page=2#post-l42evp:__241ok7:241:40digitalmars.com
    
<http://forum.dlang.org/thread/lqdktyndevxfcewgt...@forum.dlang.org?page=2#post-l42evp:241ok7:241:40digitalmars.com>


Super awesome! Phobos devs should be encouraged to use these in
non-recursive functions (particularly OS pass-through's).

Careful! Alloca doesn't get cleaned up when used in loops!

foreach(t; 0..1000) { int[t] stack_overflow; }

Reply via email to