From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7877 invoked by alias); 16 Oct 2002 02:04:29 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 7870 invoked from network); 16 Oct 2002 02:04:28 -0000 Received: from unknown (HELO hollebeek.com) (216.178.83.228) by sources.redhat.com with SMTP; 16 Oct 2002 02:04:28 -0000 Received: (from tim@localhost) by hollebeek.com (8.9.3/8.9.3) id TAA21420; Tue, 15 Oct 2002 19:17:24 -0700 Date: Tue, 15 Oct 2002 23:40:00 -0000 From: Tim Hollebeek To: Kevin Lawton Cc: Zack Weinberg , Michael Matz , Jamie Lokier , gcc@gcc.gnu.org Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check) Message-ID: <20021015191724.A21405@hollebeek.com> Reply-To: tim@hollebeek.com References: <20021016004929.GO15067@codesourcery.com> <20021016013810.22926.qmail@web80304.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20021016013810.22926.qmail@web80304.mail.yahoo.com> X-SW-Source: 2002-10/txt/msg00914.txt.bz2 On Tue, Oct 15, 2002 at 06:38:10PM -0700, Kevin Lawton wrote: > > --- Zack Weinberg wrote: > > > Sure. The question is how _soon_ you will be screwed to the point > > that the program crashes. Ideally this happens as soon after the > > actual data corruption event as possible. > [snip] > > If we wanted to stop people from shooting theirselves > in the feet, we wouldn't allow them to use C. At > any rate, sometimes it's even possible to prove the > case targets are populated: > > switch (a & 0x3) { then ask for the compiler to understand and DTRT with this syntax, instead of some funky attribute. Sure, recognizing "switch ((expr) & (integral constant 2^n-1))" only works for tables that are powers of two, but I suspect that would already go quite a ways towards what many people need. BTW, the "if you don't like the extension, don't use it" argument doesn't wash. Extensions have a non-trivial maintenance burden that has to be supported by the gcc development team, and that's a far more valuable resource than a few cycles in a few people's code.