Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: Example of C and inline ASM in a file?

2006-04-12 by jayasooriah

Hi Michael, you alluded me to a typo.

--- In lpc2000@yahoogroups.com, "Michael Rubitschka" <rubitschka@...>
wrote:

> >My experience in training has been that is that those who understood
> >from the example move on very quickly.  The ideal is that these people
> >are able to extend it to meet their particular requirements.

I meant to say "idea" but typed "ideal" and that changed the meaning
somewhat.  I meant to say that most programmers cope with it well.

> I often noticed that the medicore programmers do the best job.
> They somehow follow the ASAP-ACAN principle.
> (As simple as possible, as complex as neccessary).

Cuts both ways.  Mediocre programmers accept requirements more readily
and are usually easier to manage.  Expert programmers often dwell in
changing the requirements to meet their notion of a good solution.

Expert or mediocre, I like to think requirements come first followed
by the KISS (keep it simple, xxx) rule.  All else is optional.

> The work of gurus or experts is often much more complex
> as neccessary and one can prepare for a rewrite once that
> person leaves the company.

In case you are suggesting (I am not sure), my example is not a guru
level solution by any means.

I reckon the person who wrote the example I extracted requirements
from went to great lengths in making sure that the procedure call to
disable or enable interrupts is not taken unless necessary.

In my rewrite the procedure call is a non-issue and thus I was able to
do away with the conditionals making it simpler and deterministic.

> Their code is highly readable and maintanance friedly.

The whole idea behind using inline assembly rather than assembler
modules for my example is to show that it is both more readable *and*
easier to maintain.

One could hide ASM details in a header and then you cannot tell the
two implementations apart by looking at the code.

A maintainer would prefer to maintain C and H files than S files, when
the code is generic and common to the different architectures barring
inline ASM escapes in conditional context.

A client will not appreciate conditional code that handles just about
every variant there is on the planet when only one of these is all the
client is interested in.

> my 2 cents
> Michael

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.