> From: Reggie Bautista <[EMAIL PROTECTED]>
> 
> The Fool wrote:
> >There are less C keywords than ASM instructions.  Simple is always
> >better.
> 
> >c:
> [short code sample snipped]
> >asm:
> [longer but equivalent code sample snipped]
> 
> Just out of curiosity -- once these examples are both compiled, will
they 
> take up an equivalent amount of space and/or take an equivalent amount
of 
> time to run?

They will create the _same_ machine code.
 
> Or more generally, when programming languages include shorter ways of
doing 
> things that previous languages, how much of that comes from the writers
of 
> the newer languages having a better understanding of how to do things,
and 
> how much comes from shortcuts written into the newer language that make

> coding easier, but make no actual difference after compilation?

You mean something like this:

#define MB(x,y,z,w,q) MB+((z*(q+1)*(w+1))+(y*(w+1))+x)

#define XXX(x,y,z) ((*(m.MB((x),(y),(z),(h->X),(h->Y)))))

and later in the code just say

a.

XXX(3,14,15);

which is just the same as putting 

b.

((*(m.MB+(((z)*((h->Y)+1)*((h->X)+1))+((y)*((h->X)+1))+(x))))))

Which is essentially a calculation for a pointer to specific integer of
data in a 3 dimensional array [i.e. Matrix], (they compile to the same
code);

Which one do you want to work with hundreds of times in a program, a. or
b.?

Macros are your friends.
_______________________________________________
http://www.mccmedia.com/mailman/listinfo/brin-l

Reply via email to