From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2479 invoked by alias); 19 Nov 2012 05:42:23 -0000 Received: (qmail 2470 invoked by uid 22791); 19 Nov 2012 05:42:22 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Nov 2012 05:42:15 +0000 Received: by mail-pb0-f47.google.com with SMTP id un1so1650015pbc.20 for ; Sun, 18 Nov 2012 21:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-gm-message-state; bh=cQMwXo+V4/WsQAGMdrB7cs0UBUkyBcnDnDdPhmCf/js=; b=FJGcroaXiQiiFrsnqUhvD6RcNjZINEmHMMEvn3Yl9CthnT3w1/J9ZJJZ1BQGnHryoi kM9W8SdmFDvNeEkAhqb+MUmkVqvESTL5rhA84btWKtHpEyAjsl82lE7jc4hObILzXLxR /Sa9OE9gGxT5F/VDatBo1iY8dMVIR+ztltyonrPYOW6jrgfVCpHlt3r0+7XeRAOgu6HB cAYjL7C0rI5Aqk9WKJs0UHkEwZz3RV2c2x/tZKjAxhxfKtIGXAVlHlF27a+0tjICLbqA 6b2ozXs0+gZXExTu0Bon3oCMp7K1b5T9ORuuQveLZ9YDt+WmKiomPjm/eGrSJkswR38f pe0Q== MIME-Version: 1.0 Received: by 10.68.234.229 with SMTP id uh5mr30155553pbc.123.1353303735119; Sun, 18 Nov 2012 21:42:15 -0800 (PST) Received: by 10.68.54.133 with HTTP; Sun, 18 Nov 2012 21:42:15 -0800 (PST) In-Reply-To: <1353301824.76156.YahooMailNeo@web165005.mail.bf1.yahoo.com> References: <1353301824.76156.YahooMailNeo@web165005.mail.bf1.yahoo.com> Date: Mon, 19 Nov 2012 05:42:00 -0000 Message-ID: Subject: Re: __sync_bool_compare_and_swap() With a Pointer From: Ian Lance Taylor To: Hei Chan Cc: "gcc-help@gcc.gnu.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnlBrV3iQ6oee6ICZuX3rVJ/JvvA9EwzVFf8sAEr4r78zsI4HCNyQw80bkKJnkQmcwi9/1++x/JGYjUq6nkXuWziykf0k8sUwwlFwNbxTzoVLxlQQOTW9B8a53AraF9AWSg6aSVvzA4HLYO8atfZKL0fsX1miqRE/TOyQY1EDrzvfq7OmOWLQAVLm5x+cFPcZ2MiuKD X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-11/txt/msg00145.txt.bz2 On Sun, Nov 18, 2012 at 9:10 PM, Hei Chan wrote: > > According to http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.= html, __sync_bool_compare_and_swap() supports int, long, long long, and the= ir unsigned counterparts, and GCC will allow any integral scalar or pointer= type that is 1, 2, 4 or 8 bytes in length. > > I wonder in what situation the pointer type won't be 1, 2, 4 or 8 bytes i= n length. Let's say I am running on a 64-bit Intel CPU. On a 64-bit Intel CPU pointer types will always be either 4 or 8 bytes (4 bytes if using x32). Remember that GCC supports many different targets. In any case the sentence does not imply that there will ever be a pointer type that is not 1, 2, 4 or 8 bytes (though of course there will be if GCC ever supports a 128-bit machine). The sentence also refers to integral types, and GCC supports integral types larger than 8 bytes on some processors, e.g., __int128_t on x86_64. Ian