[fpc-devel] FExpand function
    Tomas Hajny 
    XHajT03 at mbox.vol.cz
       
    Sun Mar  5 00:24:11 CET 2006
    
    
  
On 4 Mar 06, at 22:24, Michael Van Canneyt wrote:
> On Sat, 4 Mar 2006, Joao Morais wrote:
Hi,
> > Should this comparison (!) be fixed? Seeing that this code is going to
> > be changed, what about change Pa[I] assignment from a variable to a
> > constant?
Fixed now, thanks a lot.
I replaced DirectorySeparator with the character 
according to your suggestion too, but that didn't 
really change anything, in fact - 
DirectorySeparator is a constant too, so the code 
generated for both versions is equal.
> The comparison can be fixed.
> 
> In fact I think the code can be reduced to a single loop:
> 
> if (DirectorySeparator='\') or (DirectorySeparator='/') then
>   for I:=1 to Length(PA) do
>     if (Pa[I] in ['\','/']) and (PA[I]<>DirectorySeparator) then
>       Pa[I]:=DirectorySeparator;
Preferably not, I guess. The current version 
allows to optimize the unnecessary branch away 
altogether. This version is probably considerably 
slower.
Tomas
    
    
More information about the fpc-devel
mailing list