From owner-freebsd-chat Sun Aug 10 01:16:27 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id BAA09772 for chat-outgoing; Sun, 10 Aug 1997 01:16:27 -0700 (PDT) Received: from time.cdrom.com (root@time.cdrom.com [204.216.27.226]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id BAA09767 for ; Sun, 10 Aug 1997 01:16:24 -0700 (PDT) Received: from time.cdrom.com (jkh@localhost.cdrom.com [127.0.0.1]) by time.cdrom.com (8.8.6/8.6.9) with ESMTP id BAA11993; Sun, 10 Aug 1997 01:13:15 -0700 (PDT) To: Bill Paul cc: chat@FreeBSD.ORG Subject: Re: variable sized arrays and gcc In-reply-to: Your message of "Sun, 10 Aug 1997 03:22:28 EDT." <199708100722.DAA03236@skynet.ctr.columbia.edu> Date: Sun, 10 Aug 1997 01:13:15 -0700 Message-ID: <11989.871200795@time.cdrom.com> From: "Jordan K. Hubbard" Sender: owner-freebsd-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > 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