Thread overview
VLAs?
Sep 14, 2003
Matthew Wilson
Sep 14, 2003
Walter
Sep 14, 2003
Matthew Wilson
September 14, 2003
Walter, just wondered whether we can have VLAs (via alloca()) for
fundamental types?

In other words, rather than having to write something like

    bool  lookup(int id, char *buff, inout uint cchBuff);

    uint cchBuff;
    if(lookup(<someid>, null, cchBuff))
    {
        char[]    buff = new char[cchBuff];

        lookup(<someid>, buff, cchBuff);
    }

it'd be nice to have the option of writing

    uint cchBuff;
    if(lookup(<someid>, null, cchBuff))
    {
        char    buff[cchBuff]; // <== This is allocated via alloca()

        lookup(<someid>, buff, cchBuff);
    }

Thoughts?


September 14, 2003
"Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk0m9o$31i7$1@digitaldaemon.com...
> Walter, just wondered whether we can have VLAs (via alloca()) for
> fundamental types?
>
> In other words, rather than having to write something like
>
>     bool  lookup(int id, char *buff, inout uint cchBuff);
>
>     uint cchBuff;
>     if(lookup(<someid>, null, cchBuff))
>     {
>         char[]    buff = new char[cchBuff];
>
>         lookup(<someid>, buff, cchBuff);
>     }
>
> it'd be nice to have the option of writing
>
>     uint cchBuff;
>     if(lookup(<someid>, null, cchBuff))
>     {
>         char    buff[cchBuff]; // <== This is allocated via alloca()
>
>         lookup(<someid>, buff, cchBuff);
>     }
>
> Thoughts?

I think it's a good idea. Just need more time in the day <g>.


September 14, 2003
nw. :)

"Walter" <walter@digitalmars.com> wrote in message news:bk10dd$dj3$3@digitaldaemon.com...
>
> "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bk0m9o$31i7$1@digitaldaemon.com...
> > Walter, just wondered whether we can have VLAs (via alloca()) for
> > fundamental types?
> >
> > In other words, rather than having to write something like
> >
> >     bool  lookup(int id, char *buff, inout uint cchBuff);
> >
> >     uint cchBuff;
> >     if(lookup(<someid>, null, cchBuff))
> >     {
> >         char[]    buff = new char[cchBuff];
> >
> >         lookup(<someid>, buff, cchBuff);
> >     }
> >
> > it'd be nice to have the option of writing
> >
> >     uint cchBuff;
> >     if(lookup(<someid>, null, cchBuff))
> >     {
> >         char    buff[cchBuff]; // <== This is allocated via alloca()
> >
> >         lookup(<someid>, buff, cchBuff);
> >     }
> >
> > Thoughts?
>
> I think it's a good idea. Just need more time in the day <g>.
>
>