The Cyber-Spy.Com Usenet Archive Feeds Directly
From The Open And Publicly Available Newsgroup
This Group And Thousands Of Others Are Available
On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic,
Opinions Or Content Posted To This Or Any Other
Newsgroup. This Web Archive Of The Newsgroup And
Posts Are For Informational Purposes Only.
From: Spehro Pefhany
Subject: Re: To C or not to C
X-Newsreader: Forte Agent 1.92/32.572
Date: Sat, 04 Jan 2003 00:27:55 GMT
NNTP-Posting-Date: Fri, 03 Jan 2003 19:27:55 EST
On Sat, 4 Jan 2003 11:06:02 +1100, the renowned "Michael Culley"
>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.
This is a religious question and little good can come of asking it.
Get rid of generalized library functions, especially printf() if you
want to shrink your C code (use puts() etc). Get rid of floating point
if you don't need it. Find out what all this mystery assembly code is
doing by compiling to an asm file if you can do that.
Which is better? It depends. Many of us use both or either depending
on the task. If you have a lot of text and serial comms, C should be
fine, if the compiler is a decent one, optimized for the target.
"it's the network..." "The Journey is the reward"
email@example.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup