From owner-freebsd-alpha Mon Jan 28 2:17:34 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from harrier.prod.itd.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by hub.freebsd.org (Postfix) with ESMTP id 4C67437B400; Mon, 28 Jan 2002 02:17:31 -0800 (PST) Received: from pool0101.cvx22-bradley.dialup.earthlink.net ([209.179.198.101] helo=mindspring.com) by harrier.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16V8qf-00036v-00; Mon, 28 Jan 2002 02:17:14 -0800 Message-ID: <3C552524.F8D0E562@mindspring.com> Date: Mon, 28 Jan 2002 02:17:08 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Idar Tollefsen Cc: freebsd-alpha@freebsd.org, jhb@freebsd.org Subject: Re: Using GCC 3 for ports? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Idar Tollefsen wrote: > > Don't use gcc 3.0.x. It will dump core on the following code: > > > > switch(foo) { > > default: > > blah(); > > break; > > } > > Why is this kind of constructs used instead of a simple "if" statement? > I remember at one point, there were rumors that a switch clause was > faster than an "if" statement, but I tought that argument was gone with > modern compilers who were able to optimize both just as well...? Because: switch(foo) { #ifdef NOT_ON_BY_DEFAULT_1 case 75: fum(); break; #endif #ifdef NOT_ON_BY_DEFAULT_2 case 106: fee(); break; #endif default: blah(); break; } Is a cleaner way to do it. Counter question: why won't the GCC compiler compile C code? 8-) -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message