Mail Archives: djgpp/1997/02/04/02:24:10
On Mon, 03 Feb 1997 15:14:00 -0800, "John M. Aldrich"
<fighteer AT cs DOT com> wrote:
>John M. Aldrich wrote:
>>
>> > ptr->fld1=fld1;
>> > ptr->fld2=fld2
>
>Gods... I replied too soon again. Today is obviously not my day for
>alertness. :) When you add these lines, the third function is likely
>to be marginally faster. It will be even better if you declare 'fld1'
>and 'fld2' as 'register' variables.
Is this true? I was under the impression that gcc's god-like
optimisation would generally make better choices than the average
coder for register variables, i.e. it would figure out that these
ought to be registers without being told for itself. Just a rumour,
though...
...which brings up another point: won't the first two functions also
compile to this? i.e. won't gcc either (a) remember the memory
locations it's using or (b) temporarily registerise them without being
told?
George Foot
- Raw text -