| Richard Erlacher 06/19/09 19:27 Read: 248 times Denver, Co USA |
#166272 - I can't totally disagree ... it's a matter of degree Responding to: David Prentice's previous message |
David Prentice said:
As Per and Andy have noted, it is not difficult to write portable code. High level logic is generally independent of a compiler or platform.
The low-level differences can still be covered in C in most cases with some conditional code and use of a "compatibility.h" header. This is not to say that there is no room for ASM, but the programmer who writes the portable code in the first place is a lot more desirable. He still has to know the specific operation of the target microcontroller. But there is nothing to stop Richard writing non-portable code that requires his excellent skill to maintain. And if it is ever necessary to move to another architecture, his excellent skills at re-writing in a completely new non-portable way can be used again. As any assembler programmer is well aware, 90% of the cpu time is taken up by 10% or less of the code. The application written in the HLL can often achieve very respectable efficiency with some minor tweaking in ASM. Experience has taught me that it's seldom a matter of "tweaking" and that no more than half the number of lines of code are in whichever HLL one chooses. The rest is in ASM, because one needs ASM to control the hardware. That's one reason I'd prefer to write the "main" function in ASM and have callable routines in 'C' where it is easier to express a computation in 'C' than in ASM, which is often the case. However, much of the time, when one does that, the routine could be expressed quite concisely in ASM and end up quite a bit smaller and faster. When it's not time- or size-critical, I think the HLL might be a wise choice. I've seen examples, however, where a <10-line 'C' segment compiles into a 60-line ASM code block ... one that, by hand, can be reduced to <10 lines of ASM consuming less time and code space. Now I don't care about compatibility between compilers. I want ONE compiler to handle all the cores I use. That will probably never happen. I don't even have total compatibility between the various assemblers I use. David. If the 10% of the code to which you refer is doing useful work, I'd be happy, but often it's auto-generated code that suffers in performance from the overhead imposed by the compiler. It doesn't always matter, but it certainly can matter. RE |
| Topic | Author | Date |
| What's wrong with gimme code? | Murray R. Van Luyn | 06/15/09 23:24 |
| Mainly | Jez Smith | 06/16/09 00:33 |
| I agree with Jez Smith | Kiran V. Sutar | 06/16/09 01:49 |
| Non academic gimme code? | Murray R. Van Luyn | 06/16/09 02:41 |
| This makes me very suspicious | Jez Smith | 06/16/09 02:52 |
| gimme code=my own time is too valuable | Per Westermark | 06/16/09 03:34 |
| Easy to see which is school assignment | David Prentice | 06/16/09 03:54 |
| The wise student needs pointers, not complete solutions | Per Westermark | 06/16/09 04:24 |
| "Here's what I've come up with ... | Christoph Franck | 06/16/09 04:56 |
| But what's wrong in asking for an example implementaton? | Jan Waclawek | 06/16/09 05:12 |
| The teacher recognises the good student | David Prentice | 06/16/09 05:33 |
| Now there's a laugh if ever there was one ... | Richard Erlacher | 06/16/09 13:35 |
| nothing IF ... | Erik Malund | 06/16/09 08:50 |
| children should do their own homework | Richard Erlacher | 06/16/09 13:32 |
| What's wrong with gimmee code. | Joseph Hebert | 06/16/09 00:44 |
| Sounds Like; Whats wrong with Spoon Feeding..? | Mahesh Joshi | 06/16/09 06:05 |
| perhaps it enables ... | David Prentice | 06/16/09 06:28 |
| Generic solutions applicable to more people | Per Westermark | 06/16/09 07:28 |
| Then they'll become expert at potty ... | Richard Erlacher | 06/16/09 13:37 |
| it makes you dumb! | Erik Malund | 06/16/09 08:42 |
| How'd you like ten of those guys working for you? | Richard Erlacher | 06/16/09 13:39 |
| But that's the point! | Kai Klaas | 06/17/09 08:39 |
| We agree in principle, Kai ... but ... | Richard Erlacher | 06/17/09 10:16 |
| Hiring & firing is expensive! | Andy Neil | 06/18/09 01:42 |
| and that's not all! | Richard Erlacher | 06/18/09 07:41 |
| As an example | Jez Smith | 06/16/09 15:17 |
| No-one is suggesting breach of copyright | David Prentice | 06/16/09 15:37 |
| arrogance? | Erik Malund | 06/16/09 15:48 |
| Examples of Erik's arrogance | Hans Heinz | 06/17/09 08:52 |
| no, I do not state any such, | Erik Malund | 06/17/09 09:15 |
| A couple of corrections | Richard Erlacher | 06/17/09 10:29 |
| more useful product? | Erik Malund | 06/17/09 12:30 |
| life is not B&W | Jan Waclawek | 06/16/09 15:53 |
| Good help _is_ to a big part to give hints | Per Westermark | 06/16/09 16:47 |
| Votes and freedom of speech? | Per Westermark | 06/16/09 16:57 |
| When I was a youngster ... | Richard Erlacher | 06/17/09 02:01 |
| Returning to the original subject. | David Prentice | 06/17/09 02:24 |
| same same but sometimes different | Per Westermark | 06/17/09 02:57 |
| Since you like AVRFREAKS so much ... | Richard Erlacher | 06/17/09 10:43 |
| Versatility and diversification | Per Westermark | 06/17/09 02:52 |
| This is 8052.COM | Richard Erlacher | 06/17/09 10:35 |
| and..... | Jez Smith | 06/17/09 05:05 |
| There's always help for those who can do their own work. | Richard Erlacher | 06/17/09 01:40 |
| There's the key! | Andy Neil | 06/17/09 01:54 |
| that is not the issue | Erik Malund | 06/17/09 09:18 |
| I'm with you 100% on that, Erik | Richard Erlacher | 06/17/09 10:46 |
| calm down Richard | Jez Smith | 06/17/09 11:23 |
| support for more MCU's makes it more widely useful | Richard Erlacher | 06/17/09 16:26 |
| it? | Erik Malund | 06/18/09 08:44 |
| Which MCU's will KEIL support? | Richard Erlacher | 06/18/09 13:22 |
| Irrelevant | Per Westermark | 06/18/09 16:34 |
| Keil's blind spot | Andy Neil | 06/18/09 17:33 |
| Keil will probably get squeezed | Per Westermark | 06/18/09 17:50 |
| If only that were the case | Richard Erlacher | 06/18/09 22:49 |
| Portable 'C' [edited] | Andy Neil | 06/19/09 01:56 |
| Write what you mean or mean what you write | Per Westermark | 06/19/09 03:33 |
| OK ... Here's the point | Richard Erlacher | 06/19/09 16:13 |
| If bugs is a big problem - consider your compiler choices | Per Westermark | 06/19/09 17:37 |
| C is not that difficult | David Prentice | 06/19/09 04:20 |
| I can't totally disagree ... it's a matter of degree | Richard Erlacher | 06/19/09 19:27 |
| Richard misses the point completely | Jez Smith | 06/20/09 00:18 |
| The thing is... | Andy Neil | 06/17/09 17:08 |
| I don't think thats true at all | Jez Smith | 06/18/09 04:13 |
| Not what I meant | Andy Neil | 06/18/09 05:15 |
| Andy's right! | Richard Erlacher | 06/18/09 08:11 |
| elders and betters would have given a helpful reply. | Andy Neil | 06/28/09 19:15 |
| If you think 8052.com is bad ... | Andy Peters | 06/17/09 13:14 |
| When was it the last time someone asked for code? | Jan Waclawek | 06/17/09 15:56 |
| oohhh | Jez Smith | 06/17/09 16:04 |
| Here? | Andy Neil | 06/17/09 16:23 |
| Latest example of "Gimme Code" | Andy Neil | 06/28/09 19:01 |
| What the forums are all about | CHARLES TOWNSEND | 06/26/09 07:39 |
| Progress | Steve M. Taylor | 06/26/09 10:41 |
| No, don't agree with "exhausted all the possibilities" | Per Westermark | 06/26/09 11:22 |
| patience | CHARLES TOWNSEND | 06/27/09 08:28 |
| inexperienced | CHARLES TOWNSEND | 06/27/09 08:16 |
| Well actually... | Steve M. Taylor | 06/27/09 09:44 |
| you must have a very smart wife | Erik Malund | 06/27/09 09:59 |
| If you're a friend ;-) | Steve M. Taylor | 06/28/09 04:30 |
| arrogant? | Erik Malund | 06/26/09 13:44 |
| encouragement | CHARLES TOWNSEND | 06/27/09 08:34 |
| absolutely | Erik Malund | 06/27/09 09:05 |
| What you have to remember | Jez Smith | 06/27/09 22:30 |
| Tim Berners-Lee | Steve M. Taylor | 06/28/09 04:33 |
| he only invented the web thingy | Jez Smith | 06/28/09 10:49 |
| Exhausted all the possibilities... | Per Westermark | 06/28/09 13:25 |
| this is just not fair | Jan Waclawek | 06/28/09 13:47 |
| It's about attitude | Per Westermark | 06/28/09 15:22 |
| on intentions etc. | Jan Waclawek | 06/28/09 16:27 |
| 98% of 100 | Andy Neil | 06/28/09 19:23 |
| good and bad | Erik Malund | 06/28/09 15:24 |
| OK Charles (et al), here's your chance! | Andy Neil | 06/28/09 18:58 |
| re: OK Charles here's your chance | CHARLES TOWNSEND | 07/02/09 07:44 |
| QED. | Andy Neil | 07/02/09 08:58 |
Yet one more exhausted visitor | Per Westermark | 07/03/09 02:40 |



