|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
About a week ago, I downloaded Jacob's lcc package to my new (to me)
Win/XP box and gave it a test drive this morning. The application program reads my web server's log file (currently about 35MB) and reduces it to a bunch of lists, then outputs the log contents arranged by each requestor's chronological list of hits. It's not really a strenuous test, but there's plenty of opportunity to screw up multiple levels of indirection, etc. The program was originally written on a Linux system and compiled/linked using the gcc toolchain. With the "pedantic" option it warned (8 times) about "Assignment within a conditional expression" but was otherwise friendly. The executable was some larger than I recollected the gcc version had been, but shrank by 8KB when I used the -O (peephole optimizer) option. I think that puts the size in the same ballpark with the gcc-compiled (with -O3) version. The only other C compiler I have for my current environment is TurboC V3.0 - an old friend, but not always convenient in current MS platforms. Unless I discover a particular need to use TC3 (or discover some horrible in lcc), I'll probably stick with lcc. My application (written in standard-compliant C, of course <g>) ported without any change and ran without any problem. I read comment in another thread that prompted me to comment and say to Jacob: Merci/Thanks/Gracas/Gracias/Ashkurak/Spasibo! -- Morris Dovey DeSoto Solar DeSoto, Iowa USA http://www.iedu.com/DeSoto/ |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On May 6, 6:33pm, Morris Dovey <mrdo...@iedu.com> wrote:
> The executable was > some larger than I recollected the gcc version had been, but shrank by > 8KB when I used the -O (peephole optimizer) option. Did you strip the executable, i.e. take out all the superfluous shite that isn't needed? When using gcc, here's what I do to get a lean executable: gcc hello.c -D NDEBUG -ansi -pedantic -S -O3 -o hello.exe It gave me an executable of 397 bytes for the follow program: #include <stdio.h> int main(void) { puts("Hello World!"); return 0; } |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Tomás Ó hÉilidhe wrote:
> Did you strip the executable, i.e. take out all the superfluous shite > that isn't needed? I don't remember, but I'll check when I'm next on that machine (it's 16 miles from here at my shop). I've liked using gcc on the Linux box - and expect that I'll enjoy using lcc on this one. -- Morris Dovey DeSoto Solar DeSoto, Iowa USA http://www.iedu.com/DeSoto/ |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On 6 May 2008 at 17:41, Tomás Ó hÉilidhe wrote:
> Did you strip the executable, i.e. take out all the superfluous shite > that isn't needed? Yeah, gotta hate all that superfluous shite that does absolutely nothing except let you debug your program. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Morris Dovey <mrdovey@iedu.com> writes:
> About a week ago, I downloaded Jacob's lcc package to my new (to me) > Win/XP box and gave it a test drive this morning. [...] jacob's compiler is called "lcc-win". "lcc" is a different compiler (the one on which lcc-win was based). It's an important distinction. [...] > With the "pedantic" option it warned (8 times) about "Assignment > within a conditional expression" but was otherwise friendly. Such a warning seems perfectly friendly to me. Would you prefer that it didn't tell you that you might have mistyped "==" as "="? [snip] -- Keith Thompson (The_Other_Keith) <kst-u@mib.org> Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Antoninus Twink wrote:
> On 6 May 2008 at 17:41, Tomás Ó hÉilidhe wrote: >> Did you strip the executable, i.e. take out all the superfluous shite >> that isn't needed? > > Yeah, gotta hate all that superfluous shite that does absolutely nothing > except let you debug your program. I don't much worry about it. Since loading Red Hat's v4.1 on the shop computer, I've run gdb exactly once - because I thought I should try it out for the experience (just in case). Never needed it. Still - it's there if the need does arise. -- Morris Dovey DeSoto Solar DeSoto, Iowa USA http://www.iedu.com/DeSoto/ |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Morris Dovey wrote:
> About a week ago, I downloaded Jacob's lcc package to my new (to me) > Win/XP box and gave it a test drive this morning. The application > program reads my web server's log file (currently about 35MB) and > reduces it to a bunch of lists, then outputs the log contents arranged > by each requestor's chronological list of hits. It's not really a > strenuous test, but there's plenty of opportunity to screw up multiple > levels of indirection, etc. > > The program was originally written on a Linux system and compiled/linked > using the gcc toolchain. > > With the "pedantic" option it warned (8 times) about "Assignment within > a conditional expression" but was otherwise friendly. The executable was > some larger than I recollected the gcc version had been, but shrank by > 8KB when I used the -O (peephole optimizer) option. I think that puts > the size in the same ballpark with the gcc-compiled (with -O3) version. > > The only other C compiler I have for my current environment is TurboC > V3.0 - an old friend, but not always convenient in current MS platforms. > Unless I discover a particular need to use TC3 (or discover some > horrible in lcc), I'll probably stick with lcc. > > My application (written in standard-compliant C, of course <g>) ported > without any change and ran without any problem. > > I read comment in another thread that prompted me to comment and say to > Jacob: > > Merci/Thanks/Gracas/Gracias/Ashkurak/Spasibo! > Thank you. Really. It is nice to see that my effort is good for users. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On May 6, 7:19pm, Keith Thompson <ks...@mib.org> wrote:
> Such a warning seems perfectly friendly to me. Would you prefer that > it didn't tell you that you might have mistyped "==" as "="? I love what gcc has to say about it: warning: suggest parentheses around assignment used as truth value I've actually taken its advice and started doing: if ((i=5)) DoWhatever(); |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Keith Thompson wrote:
> Morris Dovey <mrdovey@iedu.com> writes: >> About a week ago, I downloaded Jacob's lcc package to my new (to me) >> Win/XP box and gave it a test drive this morning. > [...] > > jacob's compiler is called "lcc-win". "lcc" is a different compiler > (the one on which lcc-win was based). It's an important distinction. Hmm - ok. It does identify itself as lcc-win32, but the executable is lcc.exe - I'll keep the distinction in mind. Thanks. >> With the "pedantic" option it warned (8 times) about "Assignment >> within a conditional expression" but was otherwise friendly. > > Such a warning seems perfectly friendly to me. Would you prefer that > it didn't tell you that you might have mistyped "==" as "="? Yes, unless I've actually made a mistake <vbg> -- Morris Dovey DeSoto Solar DeSoto, Iowa USA http://www.iedu.com/DeSoto/ |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
Tomás Ó hÉilidhe schrieb:
> gcc hello.c -D NDEBUG -ansi -pedantic -S -O3 -o hello.exe Ehrm, the "-S" parameter creates assembly output - are you sure that the compiled executable works? Kind Regards, Johannes -- "Wer etwas kritisiert muss es noch lange nicht selber besser können. Es reicht zu wissen, daß andere es besser können und andere es auch besser machen um einen Vergleich zu bringen." - Wolfgang Gerber in de.sci.electronics <47fa8447$0$11545$9b622d9e@news.freenet.de> |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
"Morris Dovey" <mrdovey@iedu.com> wrote in message > About a week ago, I downloaded Jacob's lcc package to my new (to me) > Win/XP box and gave it a test drive this morning. The compiler works. Which should be par for the course, though given some of the comments you hear in this forum you'd think there was a doubt about that. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
On May 6, 7:51pm, Johannes Bauer <dfnsonfsdu...@gmx.de> wrote:
> Tomás Ó hÉilidhe schrieb: > > > gcc hello.c -D NDEBUG -ansi -pedantic -S -O3 -o hello.exe > > Ehrm, the "-S" parameter creates assembly output - are you sure that the > compiled executable works? Wups I meant a lowercase S. Also I use -Wall. |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
Morris Dovey ha scritto:
> My application (written in standard-compliant C, of course <g>) ported > without any change and ran without any problem. Try do declare a define something like: unsigned char a = 0b1000000; With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you must use hexadecimal 0xF0 or decimal 128. Why this? |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
In article <4821cf0c$0$40213$4fafbaef@reader5.news.tin.it>,
nembo kid <user@localhost.com> wrote: >Try do declare a define something like: >unsigned char a = 0b1000000; >With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you >must use hexadecimal 0xF0 or decimal 128. >Why this? Because 0b is not standard C, and is an lcc-win extension ? -- "MAMA: Oh--So now it's life. Money is life. Once upon a time freedom used to be life--now it's money. I guess the world really do change. WALTER: No--it was always money, Mama. We just didn't know about it." -- Lorraine Hansberry |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
On May 7, 6:51 pm, nembo kid <u...@localhost.com> wrote:
> Morris Dovey ha scritto: > > > My application (written in standard-compliant C, of course <g>) ported > > without any change and ran without any problem. > > Try do declare a define something like: > > unsigned char a = 0b1000000; > > With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you > must use hexadecimal 0xF0 or decimal 128. > > Why this? Because 0b is not standard C. If you want a standard C solution, take a loot at <http://cprog.tomsweb.net/binconst.txt> With that header you can define a as: unsigned char a = B8(10000000); Also, if it works in compliant mode, then it's a bug. |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
nembo kid wrote:
> Morris Dovey ha scritto: > >> My application (written in standard-compliant C, of course <g>) ported >> without any change and ran without any problem. > > Try do declare a define something like: > > unsigned char a = 0b1000000; > > With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you > must use hexadecimal 0xF0 or decimal 128. > > Why this? I think it's for programmers who can only count to one. :-) -- Morris Dovey DeSoto Solar DeSoto, Iowa USA http://www.iedu.com/DeSoto/ |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
On May 6, 11:47 am, Tomás Ó hÉilidhe <t...@lavabit.com> wrote:
> On May 6, 7:19 pm, Keith Thompson <ks...@mib.org> wrote: > > > Such a warning seems perfectly friendly to me. Would you prefer that > > it didn't tell you that you might have mistyped "==" as "="? > > I love what gcc has to say about it: > > warning: suggest parentheses around assignment used as truth value > > I've actually taken its advice and started doing: > > if ((i=5)) DoWhatever(); Whenever I do that I usually write it as: if (0 != (i = 5)) DoWhatever(); to make it absolutely crystal clear what I mean. -- Paul Hsieh http://www.pobox.com/~qed/ http://bstring.sf.net/ |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
Paul Hsieh wrote:
> On May 6, 11:47 am, Tomás Ó hÉilidhe <t...@lavabit.com> wrote: >> On May 6, 7:19 pm, Keith Thompson <ks...@mib.org> wrote: >> >>> Such a warning seems perfectly friendly to me. Would you prefer that >>> it didn't tell you that you might have mistyped "==" as "="? >> I love what gcc has to say about it: >> >> warning: suggest parentheses around assignment used as truth value >> >> I've actually taken its advice and started doing: >> >> if ((i=5)) DoWhatever(); > > Whenever I do that I usually write it as: > > if (0 != (i = 5)) DoWhatever(); > > to make it absolutely crystal clear what I mean. Wouldn't i = 5; DoWhatever(); be even more crystalline? Maybe a more believable example might : while (p = p->next) ... vs. while ( (p = p->next) ) ... vs. while ( (p = p->next) != NULL ) ... -- Eric.Sosman@sun.com |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
In article <1210183118.622176@news1nwk>,
Eric Sosman <Eric.Sosman@sun.com> wrote: > Maybe a more believable example >might : > > while (p = p->next) ... >vs. > while ( (p = p->next) ) ... >vs. > while ( (p = p->next) != NULL ) ... For that particular case, I've found that for(p=first; p; p=p->next) usually makes more sense than using while, and has the bonus that I've never seen a compiler complain about it. (Depending on stylistic preferences, the second clause could also be written as 'p != NULL' or 'NULL != p'.) dave -- Dave Vandervies dj3vande at eskimo dot com Just about every state classifies bikes as vehicles, meaning that they ride on roads and obey traffic laws (you'd never guess from the way most people in this country ride bikes, though). --mark in rec.bicycles.misc |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
nembo kid wrote:
> Morris Dovey ha scritto: > >> My application (written in standard-compliant C, of course <g>) ported >> without any change and ran without any problem. > > > Try do declare a define something like: > > > unsigned char a = 0b1000000; > > > With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you > must use hexadecimal 0xF0 or decimal 128. > > Why this? I suppose 0xF0 is 240. 0x80 is 128 as is 0200. :-) -- Joe Wright "Everything should be made as simple as possible, but not simpler." --- Albert Einstein --- |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
On May 7, 4:51pm, nembo kid <u...@localhost.com> wrote:
> Morris Dovey ha scritto: > > > My application (written in standard-compliant C, of course <g>) ported > > without any change and ran without any problem. > > Try do declare a define something like: > > unsigned char a = 0b1000000; > > With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you > must use hexadecimal 0xF0 or decimal 128. You mean 0x40 or decimal 64? > > Why this? 0b-syntax doesn't exist in standard C. This actually tells you an awful lot about C and C programmers. Implementing binary literals must take all of 10 minutes in a compiler, but has rarely been done and is not part of any standard. And it's not that it's never used; it just that C programmers prefer to use ugly macros to writing straight code. Otherwise I'm sure a way of writing binary constants (computers are binary, and C is low-level) would have been standardised long ago. Or, C programmers say to use hexadecimal instead! lcc-win32 appears to have this 'extension' (if it's even that because it's so trivial to implement), the problem being that the code won't then compile anywhere else. -- Bartc |
|
|
|
#22 |
|
Messages: n/a
Hébergeur: |
Paul Hsieh wrote:
> Tomás Ó hÉilidhe <t...@lavabit.com> wrote: > .... snip ... > >> I've actually taken its advice and started doing: >> if ((i=5)) DoWhatever(); > > Whenever I do that I usually write it as: > if (0 != (i = 5)) DoWhatever(); > to make it absolutely crystal clear what I mean. FYI any non-zero integral value is taken as TRUE, while zero is taken as FALSE, by all C logical expressions. So you don't need the confusing extra garbage in the statement. The purpose of the extra parentheses is only to suppress the gcc warning. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. ** Posted from http://www.teranews.com ** |
|
|
|
#23 |
|
Messages: n/a
Hébergeur: |
Bart wrote:
> On May 7, 4:51 pm, nembo kid <u...@localhost.com> wrote: >> Morris Dovey ha scritto: >> >>> My application (written in standard-compliant C, of course <g>) ported >>> without any change and ran without any problem. >> Try do declare a define something like: >> >> unsigned char a = 0b1000000; >> >> With lcc-win works...with other compilers (i.e. mingw32-gcc) no...you >> must use hexadecimal 0xF0 or decimal 128. > > You mean 0x40 or decimal 64? > >> Why this? > > 0b-syntax doesn't exist in standard C. > > This actually tells you an awful lot about C and C programmers. > > Implementing binary literals must take all of 10 minutes in a > compiler, but has rarely been done and is not part of any standard. > Excuse me that is not correct. Took around 30 minutes... :-) > And it's not that it's never used; it just that C programmers prefer > to use ugly macros to writing straight code. Otherwise I'm sure a way > of writing binary constants (computers are binary, and C is low-level) > would have been standardised long ago. > This is just a facvility to users. As Mr Dovey proved, it is VERY easy to get it wrong! It is the best to do it automatically. > Or, C programmers say to use hexadecimal instead! > > lcc-win32 appears to have this 'extension' (if it's even that because > it's so trivial to implement), the problem being that the code won't > then compile anywhere else. > I do not know why this is not used elsewhere. -- jacob navia jacob at jacob point remcomp point fr logiciels/informatique http://www.cs.virginia.edu/~lcc-win32 |
|
|
|
#24 |
|
Messages: n/a
Hébergeur: |
jacob navia wrote:
> Bart wrote: > .... snip about binary constants ... > > This is just a facvility to users. As Mr Dovey proved, it is > VERY easy to get it wrong! It is the best to do it automatically. > >> Or, C programmers say to use hexadecimal instead! >> >> lcc-win32 appears to have this 'extension' (if it's even that >> because it's so trivial to implement), the problem being that >> the code won't then compile anywhere else. > > I do not know why this is not used elsewhere. Simple. Because it is not required by the standard. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. ** Posted from http://www.teranews.com ** |
|
|
|
#25 |
|
Messages: n/a
Hébergeur: |
jacob navia wrote:
> [... concerning 0bXXXX... numeric literals ...] > I do not know why this is not used elsewhere. How about 0qXXXX...? <off-topic> In all my days, I've only encountered one language that supported literals in all the bases 2,4,8,16: XPL, by McKeeman, Horning, and Wortman. binary: "(1)0101010101" (to any length desired) quartal: "(2)11111" ( " " " " ) octal: "(3)0525" ( " " " " ) hex: "(4)155" ( " " " " ) The (4) could be omitted at the start of a hex bit-string. The (2) constants were used a lot in their application, which was an exemplar of compiler technology circa 1970. A lot of it rested on tables of functions that had three values ("stack, reduce, special case"), and these were easily encoded (with some waste) as strings of base-four numbers. </off-topic> -- Eric Sosman esosman@ieee-dot-org.invalid |
|
![]() |
| Outils de la discussion | |
|
|