Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.misc Subject: Re: Assembly Language Message-ID: <2840@phri.UUCP> Date: Wed, 12-Aug-87 15:03:02 EDT Article-I.D.: phri.2840 Posted: Wed Aug 12 15:03:02 1987 Date-Received: Sat, 15-Aug-87 01:52:04 EDT References: <892@edge.UUCP> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 34 In article <892@edge.UUCP> doug@edge.UUCP (Doug Pardee) writes: > As a rule, assembly language programs are actually EASIER for another > programmer to pick up and figure out than are C programs (given that the > reader is fluent in the language). This isn't because of anything inherent > in the language, but simply because assembly programmers usually comment > like fiends, while C programmers think their code is self-documenting. My experience has been that most assembler code has one comment per statement, often not very useful at that. A typical example might be: add r1, r2 ; add r1 to r2, leave result in r2 cmp r2, r0 ; is r2 greater than r0? bge skip1 ; if no.... mov r0, -(sp) ; push r0 onto the stack bra skip2 ; if yes... skip1: mov r2, -(sp) ; push r2 onto the stack skip2: jsr foo ; call subroutine foo Of course, this is not to say that there aren't assembler programmers who comment the algorithm instead of translating the opcodes into english, but they seem rare. In fact, I would guess that in most assembler courses (are there any of these anymore?) the above code would get a positive nod from the instructor because every line had a comment, just like it is supposed to. That's also not to say that that writing in a HLL automatically make it easier to write useful comments. I've seen lots of C code that I couldn't figure out for the life of me with random incoherent comments that don't do anything to help describe what's going on. Ditto for Fortran, Basic, Pascal, Lisp, etc. -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016