Re: Linux / NASM equivalent of Iczelion's Win32 assembly tut's



On Wed, 05 Mar 2008 10:46:19 +0100
Herbert Kleebauer <klee@xxxxxxxxx> wrote:

What is better readable, C or assembly?

I don't want to get bogged down in arguing over definitions, but I
would like to suggest that there are two distinct levels of
readability. To illustrate this, consider this line of code from the
Nasm source:

if (pass0 == 1 || (!is_norm && !isextrn && (segment & 1))) {

From the standpoint of what the cpu will do with the code generated
from this statement, it is quite readable to anyone who knows C.

However, as Frank recently brought to my attention, there is a bug in
this code line, the symptom of which is that statements such as

foo equ 42

result in "foo" being added to the symbol table twice, if and only if
the optimization level is greater than one. There is, of course, no
diagnostic message to help one find this bug.

The problem is that there is not enough information in the code line to
allow one to determine what the the programmer intended the code to do.
It is this second, and much more important, level of readability which
is so often lacking in HLL code.

--
Chuck
http://www.pacificsites.com/~ccrayne/charles.html


.



Relevant Pages

  • Re: Factoring - a newbie question
    ... readability ... There's even a chance that you'll introduce a bug that you won't find ... already spending time debugging then you might as well simplify. ...
    (comp.lang.forth)
  • Re: TCP connect in Non Blocking Mode
    ... The OP had a bug in his code. ... I have code that uses 'poll' to wait for asynchronous connections to ... We only check writability for pending ... Setting the select for check for readability of sock descriptor didn't ...
    (comp.unix.programmer)
  • Re: intrinsic advantage of Latin alphabet over bopomofo (for Chinese)??
    ... the readability in a way that can be somehow compared to upper- and ... rather than a bug! ... One result of the allography is that word spacing is dispensable. ...
    (sci.lang)