[MUD-Dev] Languages

Miroslav Silovic silovic at srce.hr
Sun May 25 04:17:47 CEST 1997


> 'comon miro... how many times have you coded the following...
> 
> byte *t1,t2;
> 
> ...
> for (i=0;i<length;i++) *t1++ = *t2++;
> 
> or something simialr?
> 
> Such array walkign is MUCh faster then array access with [], but yould
> never guess that unless you understood what C is doing.

Not if your compiler's optimizer is worth a bother. I have seen at
least one compiler that compiles these to exactly the same code.

And then, memcpy is the right way to do it (as library specs say
that that's the function for this job).

But this shows another VERY alarming symptom of C/C++ infestation:
One shouldn't have to think in the assembler when compilers are able to prove
theorems about your code.

	Miro




More information about the mud-dev-archive mailing list