From: "Frank Bemelman"
Subject: Re: To C or not to C
Date: Sat, 4 Jan 2003 01:18:20 +0100
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
Organization: EuroNet Internet
NNTP-Posting-Date: 04 Jan 2003 00:18:31 GMT
"Michael Culley" schreef in bericht
> Thanks to everyone's help here my small project has progressed well. I now
> had a completed (although very messy) prototype. For those who didn't read
> my previous thread it is using an 8051 and a max232 to connect to a serial
> port. I'm doing this project with a friend and he prefers to use C while I
> prefer to use assembler. We have both written the software and both
> work the same with only minor differences. I can see 2 problems with using
> C. First, there is alot of extra assembly code added in that we don't know
> what it does, if this produces a bug it could be hard to track down.
> it appears to use alot more of the rom. The assembler version is 757 bytes
> and the C version is 1508 bytes. About 350 bytes is text in both, so the C
> code is almost 3 times larger than the assembler version. The C version
> had quite a few hours spent on it getting it down to 1500 bytes where the
> assembler version hasn't been optimised. 1500 bytes seams like a huge
> when we only have 2k.
> What does everyone think, which is better C or assembler? We are using
You will get a lot of different responses. With C it takes a lot of
experience in trying to imagine what the compiler has to build for
you, if you want the code to be small and/or fast. Or you can choose
not to care about it too much, if you have plenty of codespace and
plenty of processing speed. Larger programs are often easier to maintain
when written in C.
But if you can get the job done, in C, and have 500 bytes left, and no
more features to add, and it is fast enough, what is the problem?
Also, C is easier to port. Ask Spehro ;)
(remove 'x' & .invalid when sending email)