K
Keith Thompson
Chris Hills said:We have been around this several times.
It's quite simple I write a lot of specialised embedded software for
specific processors. You need the SW to be as small and fast as
possible. You don't have the luxury of adding more memory.
Therefore you have to interact with the hardware directly no OS. One
MCU I use has directly addressable bit memory. So you use 1 bit
flags. These are not standard C.
For the serial IO you directly address the UART registers the same for
CAN or USB. That is all with non standard C.
However the rest off the App will be in standard C which you would
like the be have as per the standard. Ie the if, while, switch etc .
However there is no way I will port 8051 code to a 68040 It would be
better two re-write it in standard C in a way that takes advantage of
the underlying MCU architecture.
It is the model or algorithms which are portable. Not the C a lot of
the time .
That's *your* application domain. Portability may not be important to
you, but it's very important to a lot of C programmers. And if you're
talking about going back to the C95, then portability is entirely
possible.
One of C's greatest strengths is that it allows you write non-portable
system-specific code when you have to. Another of its greatest
strengths is that it allows you to write *portable* code when
system-specificity isn't necessary. Ignoring either aspect of the
language is foolish.