Re: A89: Which is better?
[Prev][Next][Index][Thread]
Re: A89: Which is better?
Hi!
> Zeljko, your examples, which you call "good code", and not what I
> would call good code. Perhaps you mean "efficient code." Good code,
> according to my deffinition, is first and foremost code that makes
> sense. Maintainabilibty would be second, portability third, and
> efficiency perhaps fourth. When you are worried about efficiency,
> why not use inline assembly rather than unreadable C? I guess I
> have to concede that those cases may be easier to understand in
> assembly, but I consider them extreme cases.
You are mainly right ;-) I wrote my last message more for fun than
for serious discussing. But, I must quote again: if you want to do
pea 3840
pea $4c00
pea buffer
move.l $c8,a0
move.l (a0,618*4),a0
jsr (a0)
in C, and if inline assembler is not implemented, you MUST write
something like
(*(void(**)(void*,void*,long))(*(long*)0xc8+618*4))((void*)0x4c00,buffer,384
0);
There is no way to avoid this. This is not matter of "good" and
"bad" code. This is mainly the ONLY possible code (except, maybe, it
is possible to split this line into 2 or more lines, which are
also not very clear). Anyway, it is much more crypt than ASM code :-)
Zeljko