[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

1698: Re: [MUD-Dev] Languages

[Full Header] [Plain Text]
From: "Miroslav Silovic" <silovic@srce.hr>
Newsgroups: nu.kanga.list.mud-dev
Date: Sun, 25 May 1997 04:17:47 +0200 (MET DST)
References: [1]
Organization: Kanga.Nu
> '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