Re: What micros do you actually hate to work with?

As Walter showed, you can translate a piece of
assembler to C line-by-line and get virtually identical code on a
good compiler. You can't argue with that!

And I don't - especially when it is about compiling several nops linked
a few meaningless instructions, as it is in his example.

My factor of 10 is an overall figure, including the human <-> language
factor. Perhaps we can compare some actual code, can you locate
some .gif compressor or decompressor written in C? I'll then come
up with my assembly (68k, targeted at CPU32) and VPA (same code,
targeted at PPC) versions, for a comparison (they convert a plain
bitmap file into a .gif and vice versa).
Everything else is just general talk, engineering is a lot about the


Dimiter Popoff Transgalactic Instruments

Wilco Dijkstra wrote:
"Didi" <dp@xxxxxxxxxxx> wrote in message
For something like a PIC, I think C advantages are a chimera. For
a good assembly programmer productivity will improve with time as
the library of tested routines and techniques improves. With an
incomplete C system you are always fighting the restrictions of the
compiler port.

The key words are "a good assembly programmer", I guess. They seem
to be very scarce... To add to your point, a good assembly programmer
will typically be able to beat by a factor of at least 10 a C written
in terms of speed and memory resources.

You have clearly never used a compiler or you wouldn't make
such insane claims. Just show us one example where a C compiler
couldn't get within 10x of assembler. You can't, because even the
worst compiler would beat that trivially.

Modern commercial compilers always beat the average assembler
programmer and are typically within 25% of the absolute optimum.
They apply optimizations that assembly programmers have never
even heard of, and apply them consistently on large volumes of
source code even when they constantly change.

Even at the early days of C the overhead was never large - C was
specifically developed to map very easily onto the target architecture.
It is precisely this high efficiency that made C popular (and it still is
the only choice if you want fast code).

I have written lots of highly optimized code in both C and assembler.
In all cases I could get within 10-20% of the speed or size of the
assembler code. As Walter showed, you can translate a piece of
assembler to C line-by-line and get virtually identical code on a
good compiler. You can't argue with that!

I know several examples when people moved from assembler to
C (or even C++) and got significant codesize and performance
improvements. Or the case where programmers had written 100K
lines of assembler which became obsolete when they upgraded
to a better compiler...



Relevant Pages

  • Re: What micros do you actually hate to work with?
    ... with less than tiny asm ... hassle to work with 32 bit longs in assembler for an 8 bit uP, ... Microchip's C compiler tools and their assembly under MPLAB. ... is that other programmers for C are easier to find. ...
  • Re: The Promise of Forth
    ... Declare variables, declare locals, let the compiler do the work ... Forth could be considered the assembler for a simplified virtual ... If you use locals then you have to initialise them each time. ... there are likely to be libraries that could be profitably used within ...
  • The never ending assembly vs. HLL war
    ... > branch instruction excluded is not particularly effective optimization. ... > CPU, chances are pretty good it *won't* be optimal on a different CPU. ... > discussing the futility of optimizing it in *assembler* when the ... careful and consider the code the compiler is emitting (and adjust your ...
  • Re: the quality of assembly language code
    ... Intel's compiler is supposed to ... I have found that I prefer 'C' and assembler roughly in inverse ... >> code than human beings writing raw assembly language. ... > assembly programmers and compilers. ...
  • Re: Microcontroller Project
    ... A C compiler will just mask the nonsense underneath. ... A heck of a lot of poeple will use C on micros because it provides many ... I still do some inline assembler where it's called ... Thousands of embedded engineers who use C almost exclusively will tell ...