From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: Using Pointers ? Date: Tue, 04 Feb 1997 06:02:21 GMT Organization: Oxford University Lines: 26 Message-ID: <32f6cfe0.53398230@news.ox.ac.uk> References: <32F662F9 DOT 1F3B AT post DOT comstar DOT ru> <32F66FB9 DOT 1FC2 AT cs DOT com> <32F67138 DOT D72 AT cs DOT com> NNTP-Posting-Host: mc31.merton.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp On Mon, 03 Feb 1997 15:14:00 -0800, "John M. Aldrich" 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