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.
Reply-To: "Kevin Aylward"
From: "Kevin Aylward"
References: <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
Subject: Re: To C or not to C
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-Inktomi-Trace: public1-pete2-5-cust126.pete.broadband.ntl.com 1041885534 10596 220.127.116.11 (6 Jan 2003 20:38:54 GMT)
Date: Mon, 6 Jan 2003 20:38:53 -0000
NNTP-Posting-Date: Mon, 06 Jan 2003 20:38:54 GMT
Frank Bemelman wrote:
> "Kevin Aylward" schreef in bericht
>> nospam wrote:
>>> email@example.com (Nico Coesel) wrote:
>>>> Hate is a big word, but just look at this code and how it compiles
>>>> on the Dunfield 8051 compiler and SDCC:
>>>> //copy from program memory to data
>>>> strcpy_r(unsigned char o, code unsigned char i)
>>>> unsigned char a;
>>>> while (i[a]!= 0)
>> But if you wanted this to run faster, you would not do it this way
>> in c. You would reorganise it, because the compiler has to multiply
>> by a. e.g.
>> char *po=o;
>> char *pi=i;
>> while (*pi != 0)
>> ignoring the possibility of merging the ++'s for now.
> You forgot to add one *po=*pi at the end ;)
Actually, I did not forget, just could not be bothered:-)
The shortest way would
> be: while(*po++=*pi++); but always nice to check what it turns into.
Having not actually looked at a compiler output for maybe 7 years, I'm
not sure whether or not statements on one line like this always expand
to better code then simply making separate ones. However, I don't like
the po++ on the left hand side, I don't think that's it guaranteed to
expand in the correct order.
In my own code, I usually use the longer text versions as it is clearer.
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup