RE: A89: Which is better?


[Prev][Next][Index][Thread]

RE: A89: Which is better?



Who writes code like that? I doubt that is how you write your C code. I'll
bet you write it just as nicely as you would write assembly. We aren't
asking which can we make the hardest to read.

In C, you could say printf("Hello, world") in a few million different ways.

ya and this is how you do that same thing in assembly.

lea string(pc),a0
move.l a0,-(a7)
move.w #0,-(a7)
move.w #0,-(a7)
jsr tios::DrawStrXY
add.l #10,a7
......REST OF CODE......
string:
  dc.b "Hello World",0

Changing the font and adding other attributes is another story.
And as with C there is a "million" different ways to do that same thing in
assembly. Personally I can understand what printf("Hello, world") is much
easier than the assembly example. You are right about having a hard time
grasping whatever language you don't understand but if you are a newbie and
you don't know either one C is much easier. 

If this email wasn't so big already I would copy a piece of code I did in
both assembly and C. That way you could truly see which one is harder. I
will paste it in another email if anyone cares.

-Brady

-----Original Message-----
From: owner-assembly-89@lists.ticalc.org
[mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of M. Adam Davis
Sent: Tuesday, May 30, 2000 2:08 PM
To: assembly-89@lists.ticalc.org
Subject: Re: A89: Which is better?



The fact that assembly must be written in a specific way (column 1 is
reserved
for labels, 2 and beyond for mnemonics, one space between the mnemonic and
the
operand, comma betweeen multiple operands, and no more than one instruction
per
line) makes it much easier to read than C programs which have been
purposfully
obfuscated:

#define p struct c #define q struct b #define h a->a #define i a->b #define
e
i->c #define o a=(*b->a)(b->b,b->c) #define s return a;}q* #define n
(d,b)p*b;{q*a;p*c; #define z(t)(t*)malloc(sizeof(t)) q{int a;p{q*(*a)();int
b;p*c;}*b;};q*u n a=z(q);h=d;i=z(p);i->a=u;i->b=d+1;s v n c=b;do
o,b=i;while(!(h%d));i=c;i->a=v;i->b=d;e=b;s w n
o;c=i;i=b;i->a=w;e=z(p);e->a=v;e->b=h;e->c=c;s t n
for(;;)o,main(-h),b=i;}main(b){p*a;if(b>0)a=z(p),h=w,a->c=z(p),a->c->a=u,
a->c->b=2,t(0,a);putchar(b?main(b/2),-b%2+'0':10);}

Even under assembly there are a very limited way of saying things.  In C,
you
could say printf("Hello, world") in a few million different ways.

But if you don't have a good grasp of either language, then you'll certianly
have a problem in the one you don't fully understand.

-Adam

Brady Simon wrote:
>
> I don't mean to bash on you or anything but do you honestly think it is
> harder to read C than it is to read assembly? Looking back at my assembly
> code I think it is a lot easier to read C.
>
> -----Original Message-----
> From: owner-assembly-89@lists.ticalc.org
> [mailto:owner-assembly-89@lists.ticalc.org]On Behalf Of Zeljko Juric
> Sent: Tuesday, May 30, 2000 11:34 AM
> To: assembly-89@lists.ticalc.org
> Subject: Re: A89: Which is better?
>
> Hi!
>
> > i cant ever imagine finding assembly easier then C... (in most respects)
> C
> > seems alot like basic to me. and its especially easy after learning
> > cgi/perl. they seem almost the same...
>
> Generally, C is easier than ASM, but C programs may be much more cryptic
> than ASM programs, e.g. C programs sometimes may be absolutely
> ununderstandable. It is not hard to write such programs, but it is
> very hard to read and understand them. That's why C is sometimes
> called "write-only language".
>
> Zeljko Juric
Warning
Could not process part with given Content-Type: application/ms-tnef; name="winmail.dat"

References: