Do not spill variables/registers on the stack

David Brown david@westcontrol.com
Thu Feb 3 09:44:00 GMT 2011


On 02/02/2011 21:49, Stefan Schulze Frielinghaus wrote:
> On Mi, 2011-02-02 at 21:32 +0100, Drasko DRASKOVIC wrote:
>> On Wed, Feb 2, 2011 at 7:35 PM, Stefan Schulze Frielinghaus
>> <stefan@seekline.net>  wrote:
>>> On Mi, 2011-02-02 at 11:08 -0700, Jeff Law wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> On 02/02/11 10:34, Philip Herron wrote:
>>>>
>>>>>
>>>>> I am not quite sure what you are asking/trying to do but the register
>>>>> keyword is used to tell the compiler keep this variable inside any
>>>>> available registers which is useful if your going to use it alot in a
>>>>> piece of code i would imagine it could speed up things alot.
>>>> GCC ignores the "register" keyword.
>>>
>>> GCC does _not_ ignore the "register" keyword.
>>
>> Are you sure ? I mean, are you sure what Jeff was suggesting with his
>> short and not elaborated answer ?
>> I mean, what if he wanted to say : " GCC ignores the 'register'
>> keyword if no-optimization (-O0) flag was passed." ?
>>
>> That's why I asked for clarification, for in that case he might be right.
>
> I took his words as a "for all" statement and proved by a counter
> example that at least in one case it is not true ;-)
>
> No seriously, just wait for his respond. There might be situations where
> the keyword is ignored. I can only guess ...
>

My understanding is that "register" is ignored at -O1 and above, which 
would seem to match your experience.




More information about the Gcc-help mailing list