From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30629 invoked by alias); 16 Oct 2002 20:02:35 -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 30579 invoked from network); 16 Oct 2002 20:02:33 -0000 Received: from unknown (HELO hollebeek.com) (216.178.83.228) by sources.redhat.com with SMTP; 16 Oct 2002 20:02:33 -0000 Received: (from tim@localhost) by hollebeek.com (8.9.3/8.9.3) id NAA25195; Wed, 16 Oct 2002 13:14:37 -0700 Date: Wed, 16 Oct 2002 13:38:00 -0000 From: Tim Hollebeek To: Michael Matz Cc: Kevin Lawton , Zack Weinberg , Jamie Lokier , gcc@gcc.gnu.org Subject: Re: Request of new __attribute__ for switch statements (elimination of the bounds check) Message-ID: <20021016131437.A25171@hollebeek.com> Reply-To: tim@hollebeek.com References: <20021015191724.A21405@hollebeek.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: X-SW-Source: 2002-10/txt/msg00992.txt.bz2 > > > switch (a & 0x3) { > > > > then ask for the compiler to understand and DTRT with this syntax, > > instead of some funky attribute. > > Although remember that we have two cases in this thread. Things like > fully populated "switch (a & A_CONSTANT)" or "switch (a_char)", which > clearly should be optimized by the compiler itself without syntantic help. > > And that "switch (an_enum)" thing, also "fully populated" in the sense > that all enumeration values are mentioned. Cases like that that are performance critical, not a factor of two, and cannot be expanded to a factor of two? I don't buy it. Remember, we already have -Wswitch, and default: abort(), which are adequate for all but the most performance intensive cases. -Tim