From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28166 invoked by alias); 6 Jan 2008 20:42:00 -0000 Received: (qmail 28156 invoked by uid 22791); 6 Jan 2008 20:41:59 -0000 X-Spam-Check-By: sourceware.org Received: from caffeine.csclub.uwaterloo.ca (HELO caffeine.csclub.uwaterloo.ca) (129.97.134.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 06 Jan 2008 20:41:42 +0000 Received: from caffeine.csclub.uwaterloo.ca (localhost [127.0.0.1]) by caffeine.csclub.uwaterloo.ca (Postfix) with ESMTP id 4CEBE73D41 for ; Sun, 6 Jan 2008 15:41:40 -0500 (EST) Received: by caffeine.csclub.uwaterloo.ca (Postfix, from userid 20006) id 3F89B73D49; Sun, 6 Jan 2008 15:41:40 -0500 (EST) To: gcc@gcc.gnu.org Subject: Re: __builtin_expect for indirect function calls Message-Id: <20080106204140.3F89B73D49@caffeine.csclub.uwaterloo.ca> Date: Sun, 06 Jan 2008 20:42:00 -0000 From: rridge@csclub.uwaterloo.ca (Ross Ridge) Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00050.txt.bz2 Mark Mitchell writes: > What do people think? Do we have the leeway to change this? If it were just cases where using __builtin_expect is pointless that would break, like function overloading and sizeof then I don't think it would be a problem. However, it would change behaviour when C++ conversion operators are used and I can see these being legitimately used with __builtin_expect. Something like: struct C { operator long(); }; int foo() { if (__builtin_expect(C(), 0)) return 1; return 2; } If cases like these are rare enough it's probably an acceptable change if they give an error because the argument types don't match. Ross Ridge