From: "Frank Bemelman"
Newsgroups: sci.electronics.design
References: <3e162515$0$27994$afc38c87@news.optusnet.com.au>
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
Message-ID: <3e162857$0$37215$1b62eedf@news.euronet.nl>
Organization: EuroNet Internet
NNTP-Posting-Date: 04 Jan 2003 00:18:31 GMT
NNTP-Posting-Host: hlg-n-5c88.mxs.adsl.euronet.nl
"Michael Culley" schreef in bericht
news:3e162515$0$27994$afc38c87@news.optusnet.com.au...
> 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
versions
> 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.
Second,
> 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
has
> 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
waste
> when we only have 2k.
>
> What does everyone think, which is better C or assembler? We are using
SDCC.
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 ;)
--
Thanks,
Frank Bemelman
(remove 'x' & .invalid when sending email)