Thread overview | |||||
---|---|---|---|---|---|
|
September 14, 2003 VLAs? | ||||
---|---|---|---|---|
| ||||
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 Re: VLAs? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew Wilson | "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 Re: VLAs? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | 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>. > > |
Copyright © 1999-2021 by the D Language Foundation