From: Jonathan Kirwan
Subject: Re: To C or not to C
X-Newsreader: Forte Agent 1.92/32.572
NNTP-Posting-Date: Sun, 05 Jan 2003 00:14:24 GMT
Organization: AT&T Broadband
Date: Sun, 05 Jan 2003 00:14:24 GMT
On Sat, 4 Jan 2003 18:23:50 -0500, "D Poinsett"
>Right you are.
>I frequently use inline assembler just to take advantage of the HC11/HC12
>instructions for setting/resetting individual bits. It's an elegant
>instruction that fulfills a commonly used function in embedded designs. Most
>C compilers are much more clumsy at this and, in fact, one must be very
>careful that the bits are managed correctly when doing it in C only. There
>are probably other and better examples but this came to mind.
(I won't take the time to put this discussion in order. Folks
will just have to cope...)
I wasn't thinking about that. C can simulate "rotate left" and
"rotate right," for example, or bit set and bit clear, as you
mention. I'm talking about <> which simply cannot be
reached. I'm not talking 'just clumsily', but *impossible* no
matter how much or little code is written. Quite another story.
>"Jonathan Kirwan" wrote in message
>> On Sat, 4 Jan 2003 12:45:36 -0500, "D Poinsett"
>> >Often only a few, if any, sections of code need blazing speed.
>> That isn't the only reason for assembler coding. There are
>> semantics available in assembler that aren't just "difficult" in
>> C, but impossible to code in C. Just wanted to point out that
>> speed isn't the sole driver for choosing asm, at times.