From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31295 invoked by alias); 19 Sep 2014 11:18:42 -0000 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 Received: (qmail 31282 invoked by uid 89); 19 Sep 2014 11:18:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: mailfilter05.hatteland.com Received: from mailfilter05.hatteland.com (HELO mailfilter05.hatteland.com) (213.162.250.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 19 Sep 2014 11:18:37 +0000 Received: from mailfilter05.hatteland.com (localhost [127.0.0.1]) by mailfilter05.hatteland.com (Postfix) with ESMTP id 3E211F1A32; Fri, 19 Sep 2014 13:18:33 +0200 (CEST) Received: from mailfilter05.hatteland.com (localhost [127.0.0.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailfilter05.hatteland.com (Postfix) with ESMTPS id 9C9D0F1A4C; Fri, 19 Sep 2014 13:18:30 +0200 (CEST) Received: from JHSVMHUB02.netsentral.no (unknown [172.21.1.26]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mailfilter05.hatteland.com (Postfix) with ESMTPS id 97A0FF1A38; Fri, 19 Sep 2014 13:18:30 +0200 (CEST) Received: from [192.168.0.65] (172.21.20.11) by e2010.hatteland.com (172.21.1.26) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 19 Sep 2014 13:18:30 +0200 Message-ID: <541C1106.8050604@westcontrol.com> Date: Fri, 19 Sep 2014 11:18:00 -0000 From: David Brown User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Ian Lance Taylor , Ali Abdul Ghani CC: "gcc-help@gcc.gnu.org" Subject: Re: Register Variables in c References: In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2014-09/txt/msg00115.txt.bz2 On 19/09/14 00:56, Ian Lance Taylor wrote: > On Thu, Sep 18, 2014 at 2:15 AM, Ali Abdul Ghani wrote: >> >> I have a question >> I read about register variables >> gcc Support register variables?? >> >> or treat him like any other variable?? > > In GCC the only meanings of the register qualifier are that you can't > the address of a register variable, and as a GCC extension you can > declare the specific register that the variable should go into. > I believe the register qualifier is used as a hint when you compile without optimisation, and will encourage the compiler to put the variable in a register rather than on the stack. The hint is ignored when optimising - they are treated as any other variable (other than making it illegal to take an address), as the compiler will do a better job of allocating variables to registers than a human would. David