Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Wed, 27 Jun 2012 01:27:25 -0500 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: Variable-length arrays: should they be used at all? References: <4FEA09E4.5010003@loria.fr> <971dc7bf-5589-46e6-9b44-e24f6c4d8c50@googlegroups.com> Date: Wed, 27 Jun 2012 07:27:25 +0100 Message-ID: <87iped9smq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:goC5qREG77LWYHFJciYLnPZM+Eo= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 15 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Sq2CDtzr9v2+PKJO3CsfP/POmloP3WPpCSoRKMsBKkZ0cXrS+8oBgbum0m0LvcRgt0Y/7DA+j2Js7Yy!AyILNB4n/cJ44qsfPWjsNAtz4lbRaZM3FjqpKbA46kN8UtVm9QmGnLbcNrpjV/EsNRyN X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1891 Xref: csiph.com comp.lang.c:22850 David Resnick writes: > On Tuesday, June 26, 2012 3:47:08 PM UTC-4, Rui Maciel wrote: >> Undoubtedly, VLAs are convenient. Yet, with that convenience comes the >> danger of making an otherwise flawless program susceptible to nasty memory >> allocation problems. No matter how convenient VLAs might be, having to >> handle unexplainable segfaults that can't be avoided with the dilligent use >> of safeguards may not be an acceptable tradeoff. > > Yep, they should be used with caution. Mind you, the same arguments > apply to using recursion. How deeply you can safely recurse, and the > consequences if you go too deep, also murky. I completely agree. But it strikes me that programmers are more aware of the dangers of recursion than of VLAs.