??? 07/27/06 09:48 Modified: 07/27/06 09:48 Read: times |
#121151 - arguments Responding to: ???'s previous message |
Peter Dannegger said:
I like C, because reusing code on another CPU was many times easier. I did not talk about reusing code. I talked about project porting. That's not necessarily the same. Peter Dannegger said:
Also I test often new algorithm with Borland-C before I use it on the 8051. I often test new algorithms on PC, too, using various tools; however, usually I then rewrite them optimised for the given platform. But I have a story for this (I know, stories have little statistical value, but this I think is nice). Incidentally, a few weeks ago I wrote a piece of software using Borland-C in DOS for testing a particular communication protocol (for banknote acceptors and similar devices) involving encryption. I don't like C so I use it in a very conservative manner, almost making something like Pascal out of it. I made sure it was written in nice modular form (nice, but very inefficient - I didn't care about the latter, as I knew it will not be used in this form but be reused by others in other projects). One of my colleagues rewrote it for something Windowish, with almost zero effort. Then, an another colleague attempted to port it for AVR/gcc. We spent several hours debugging only a few lines of program (I still refuse call it code, I believe it is thoroughly readable). This was certainly not the question of resources - it was only a couple of routines, using one relatively small array of bytes and a few other variables (indices and similar). The problem lied in a combination of: - I am not a C guru, apparently he was not either - in C, except gurus, nobody knows what does "int" mean (even "short" or "long" won't make it any better) - gcc made an unexpected retyping (expansion) and sign extension when shifting Peter said:
If you have difficulties to reuse code, I suspect your writing style was not modular. I did not say I have difficulties. I said, I had NO extra difficulties porting asm (as compared to C) - perhaps also thanks to being modular in asm. But I take your point in reusing the snippets, if you work with multiple platforms at once, or moving between them often (othewise if you stick to one platform you would probably try to write an optimised platform-specific version of the same). That certainly is a + for C (or, speaking of C, shall I say ++ ? :-) ) or more generally for HLL. Jan Waclawek |
Topic | Author | Date |
How long we see 8051 | 01/01/70 00:00 | |
unofficial history of 8051 | 01/01/70 00:00 | |
History, or prediction? | 01/01/70 00:00 | |
It seems to gain, not lose | 01/01/70 00:00 | |
Does it matter? | 01/01/70 00:00 | |
Double negative? | 01/01/70 00:00 | |
to C or not to C | 01/01/70 00:00 | |
Defintely 'C'! | 01/01/70 00:00 | |
yeah, let's flame! | 01/01/70 00:00 | |
Defintely 'C'! | 01/01/70 00:00 | |
arguments | 01/01/70 00:00 | |
An example for 8051/AVR | 01/01/70 00:00 | |
contra-example for 8051/AVR | 01/01/70 00:00 | |
A slight mistake | 01/01/70 00:00 | |
stdint.h | 01/01/70 00:00 | |
That's your trouble, then! | 01/01/70 00:00 | |
Compiler independant | 01/01/70 00:00 | |
C is not better | 01/01/70 00:00 | |
bringing 2 togethert | 01/01/70 00:00 | |
Opening pandora's box | 01/01/70 00:00 | |
Learning C | 01/01/70 00:00 | |
for a beginner ...![]() | 01/01/70 00:00 | |
are You sure? | 01/01/70 00:00 | |
Portability and scars | 01/01/70 00:00 | |
I'm an ASM Guru but | 01/01/70 00:00 | |
why discuss the rare exception tha same apply | 01/01/70 00:00 |