??? 12/04/07 13:58 Read: times |
#147850 - who gives a hoot about portability Responding to: ???'s previous message |
In the small embedded (i.e. no BIOS) environment, you have two groups of code:
I/O and calculations I/O is inherently non-portable and calculations, when written in C, are inherently portable. I know that a purist will disagree with "calculations, when written in C, are inherently portable" but I will rather spend 10 minutes editing "partially portable" code than have to look at code with 4711 #if's such as #if SDCC, #if Keil, #if IAR, #if HiTech ..... #if SILABS_DERIVATIVE, #if SILABS_DEVIATE, #if MCS51, #if Z80 ..... #if themoonisblue .... So, in conclusion who gives a hoot about portability, any code can be used as a template (reused with minor editing) and that is portability that does not make your code unreadable/unmaintainable for some lofty goal that has no purpose whatsoever since porting of small embedded is so unlikely that preparing for it makes no sense. My experience with the need for portability of small embedded stem from 2 episodes where the micro used for a product became discontinued and in both cases the management said "now that we have to work on it anyhow, let us do this and this and this too" and thus, in effect, made the task "write new code using the existing as a template" rather than "use the portable code" (had it been portable, the effort to make it portable would have been wasted, since it was not 'ported') Another case of 'portability' was a product where the "low cost" versions were to run on one processor and the "advanced' versions were to run on another. Several wild and crazy schemes were proposed, but after 'a fight' the working solution won: "make a BIOS for each" so the rest of the code can be common C source. In my opinion, what makes sense in small embedded is not the purists definition of 'portability', but using existing code as a template. Erik |
Topic | Author | Date |
How to write portable code | 01/01/70 00:00 | |
C is a language - not a compiler | 01/01/70 00:00 | |
PL/M | 01/01/70 00:00 | |
Have you considered PLM2C? | 01/01/70 00:00 | |
A good point - often missed | 01/01/70 00:00 | |
So what's the downside? | 01/01/70 00:00 | |
Complex code - Libraries | 01/01/70 00:00 | |
COTS libraries versus inhouse libraries | 01/01/70 00:00 | |
Hence portability is not such a big issue! | 01/01/70 00:00 | |
There are downsides | 01/01/70 00:00 | |
Portability vs. Readability/Maintainability. | 01/01/70 00:00 | |
who gives a hoot about portability | 01/01/70 00:00 | |
Portable by BIOS | 01/01/70 00:00 | |
I give a hoot about portability | 01/01/70 00:00 | |
I am definitely not arguing against "code reuse" | 01/01/70 00:00 | |
HAL | 01/01/70 00:00 | |
Small and easy things that may make Your day | 01/01/70 00:00 | |
The developer is probably the biggest factor | 01/01/70 00:00 | |
I may take issue with this one... | 01/01/70 00:00 | |
general re 'portable code' | 01/01/70 00:00 |