Date: Sun, 10 Aug 1997 01:13:15 -0700 From: "Jordan K. Hubbard" <jkh@time.cdrom.com> To: Bill Paul <wpaul@skynet.ctr.columbia.edu> Cc: chat@FreeBSD.ORG Subject: Re: variable sized arrays and gcc Message-ID: <11989.871200795@time.cdrom.com> In-Reply-To: Your message of "Sun, 10 Aug 1997 03:22:28 EDT." <199708100722.DAA03236@skynet.ctr.columbia.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
> The problem here is that the array 'buf' is being declared with > a variable size. My mommy always told me that you couldn't do that: > buf[10] is okay, buf[strlen(foo) + 10] is not. At first I thought I > was losing my marbles, but it that seems gcc will compile this code. This has been a gcc feature for ages (and I mean years) but I've always avoided it in favor of an explicit alloca() call for the same reason - I don't want code which walks that far outside ANSI's painted lines. info gcc And look at the gcc enhancements section. Jordan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?11989.871200795>