* Register Variables in c
@ 2014-09-18 9:15 Ali Abdul Ghani
2014-09-18 11:51 ` Tim Prince
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ali Abdul Ghani @ 2014-09-18 9:15 UTC (permalink / raw)
To: gcc-help
hi list
I have a question
I read about register variables
gcc Support register variables??
or treat him like any other variable??
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Register Variables in c
2014-09-18 9:15 Register Variables in c Ali Abdul Ghani
@ 2014-09-18 11:51 ` Tim Prince
2014-09-18 22:56 ` Ian Lance Taylor
2014-09-21 1:27 ` Kayven Riese
2 siblings, 0 replies; 5+ messages in thread
From: Tim Prince @ 2014-09-18 11:51 UTC (permalink / raw)
To: gcc-help
On 9/18/2014 5: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??
This is covered in reasonable detail in online docs, e.g.
https://gcc.gnu.org/onlinedocs/gcc/Explicit-Reg-Vars.html
As you're probably aware, the primary portable purpose of "register" is
to prevent taking the address.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Register Variables in c
2014-09-18 9:15 Register Variables in c Ali Abdul Ghani
2014-09-18 11:51 ` Tim Prince
@ 2014-09-18 22:56 ` Ian Lance Taylor
2014-09-19 11:18 ` David Brown
2014-09-21 1:27 ` Kayven Riese
2 siblings, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2014-09-18 22:56 UTC (permalink / raw)
To: Ali Abdul Ghani; +Cc: gcc-help
On Thu, Sep 18, 2014 at 2:15 AM, Ali Abdul Ghani <blade.vp2020@gmail.com> 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.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Register Variables in c
2014-09-18 22:56 ` Ian Lance Taylor
@ 2014-09-19 11:18 ` David Brown
0 siblings, 0 replies; 5+ messages in thread
From: David Brown @ 2014-09-19 11:18 UTC (permalink / raw)
To: Ian Lance Taylor, Ali Abdul Ghani; +Cc: gcc-help
On 19/09/14 00:56, Ian Lance Taylor wrote:
> On Thu, Sep 18, 2014 at 2:15 AM, Ali Abdul Ghani <blade.vp2020@gmail.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Register Variables in c
2014-09-18 9:15 Register Variables in c Ali Abdul Ghani
2014-09-18 11:51 ` Tim Prince
2014-09-18 22:56 ` Ian Lance Taylor
@ 2014-09-21 1:27 ` Kayven Riese
2 siblings, 0 replies; 5+ messages in thread
From: Kayven Riese @ 2014-09-21 1:27 UTC (permalink / raw)
To: Ali Abdul Ghani; +Cc: gcc-help
On 9/18/14, Ali Abdul Ghani <blade.vp2020@gmail.com> wrote:
> hi list
> I have a question
> I read about register variables
> gcc Support register variables??
>
> or treat him like any other variable??
>
you have TO use inline assembly code. it has to bedone in assembly
language which will be machine specific. try googling using assembly
language in C. I am working on a flip phone here.
--
Sincerely,
Kayven Riese
*----------------------------------------------------------*
Kayven Riese, MSCS,
MS (Physiology and Biophysics)
(415) 902 5513 cellular
http://kayve.net
Webmaster http://ChessYoga.org
*----------------------------------------------------------*
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-21 1:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-18 9:15 Register Variables in c Ali Abdul Ghani
2014-09-18 11:51 ` Tim Prince
2014-09-18 22:56 ` Ian Lance Taylor
2014-09-19 11:18 ` David Brown
2014-09-21 1:27 ` Kayven Riese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).