Date: Mon, 28 Jan 2002 02:17:08 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: Idar Tollefsen <Idar.Tollefsen@baerum.kommune.no> Cc: freebsd-alpha@freebsd.org, jhb@freebsd.org Subject: Re: Using GCC 3 for ports? Message-ID: <3C552524.F8D0E562@mindspring.com> References: <sc55311c.075@mail.baerum.kommune.no>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C552524.F8D0E562>
