From owner-freebsd-arch@FreeBSD.ORG Fri Mar 12 14:26:16 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99FF0106564A for ; Fri, 12 Mar 2010 14:26:16 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by mx1.freebsd.org (Postfix) with ESMTP id 2E9A58FC08 for ; Fri, 12 Mar 2010 14:26:15 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-064-178-136.pools.arcor-ip.net [88.64.178.136]) by mrelayeu.kundenserver.de (node=mreu0) with ESMTP (Nemesis) id 0MH3Li-1Ntzde1SJm-00DmcU; Fri, 12 Mar 2010 15:13:40 +0100 Received: (qmail 15568 invoked from network); 12 Mar 2010 14:13:39 -0000 Received: from f8x64.laiers.local (192.168.4.188) by mx.laiers.local with SMTP; 12 Mar 2010 14:13:39 -0000 From: Max Laier To: freebsd-arch@freebsd.org Date: Fri, 12 Mar 2010 15:13:38 +0100 User-Agent: KMail/1.12.4 (FreeBSD/8.0-RELEASE-p2; KDE/4.3.5; amd64; ; ) References: <20100312122559.GU8200@hoeg.nl> <20100312124258.GE1738@mole.fafoe.narf.at> In-Reply-To: <20100312124258.GE1738@mole.fafoe.narf.at> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003121513.38721.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19yUenW3mR58DqUWhAbwJcZmVY2JHypcqI5XEB Whq5DcMTwClki1QCFtuGqmFyMx6MaFWD4skNVenmqTWLPgxT7b qjKHn6R5ibH2cFFayQ70w== Subject: Re: likely and unlikely X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2010 14:26:16 -0000 On Friday 12 March 2010 13:42:59 Stefan Farfeleder wrote: > On Fri, Mar 12, 2010 at 01:26:08PM +0100, Ed Schouten wrote: > > Hi Ivan, > > > > * Ivan Voras wrote: > > > Wouldn't it be more convenient to have a single global definition of > > > them, under #ifdef __GNUC__ for example in sys/stddef.h ? > > > > Wouldn't it be better to have them in sys/cdefs.h? > > Putting macros 'likely' and 'unlikely' into sys/cdefs.h creates a big > namespace violation problem; C code using those identifiers will break. In addition, I don't think it's a good thing to make these too easy to use ... I found that they are a pessimisation more often than not. In addition, it seems that at least our base gcc version does forget to apply any other optimizations if it encounters one of these. My point is: Handle with care!!! Trust your compiler/CPU predictors/... - most of the time, they are smarter than you are ;) Regards, Max