Unix was written in C. Lisa was written in Pascal. Knock Knock Who's there? (long pause) Lisa! If you like Pascal, go ahead and use it. I prefer C. That filter we=20 discussed a while back? I implemented my version, averaging 10=20 frequency samples, in C (CCS) on a 16F636. Took about 10 minutes. set_timer1(0); TMR1ON=3D1; delay_ms(10); TMR1ON=3D0; val=3Dget_timer1(); total+=3Dval; total-=3Dfilt; filt=3Dtotal/10; Kerry Olin Lathrop wrote: > PETER ONION wrote: > =20 >>> Worse, what I wrote above would not be >>> interpreted as intended, but would be perfectly legal and not >>> generate any compile error. >>> =20 >> Indeed, but who's fault is that ? You wrote valid C and that's >> really all the compiler can check for. If your C code doesn't >> do what you expected it to do then it's because you don't understand >> the C syntax and that's not the compiler's fault ! ;-) >> =20 > > It's not about "fault", and in any case it can't be the compiler's since > it's just following the rules of the language. Of course it's on the > programmer to know the syntax of the language, but there is also good and > bad syntax design. > > In this case the syntax allows a easily made error to still result in leg= al > code but to not be interpreted as intended. Programmers will always come= up > with more clever errors than a language designer can and should account f= or, > but a measure of good language design is how much common and > should-be-anticipated errors get caught as illegal syntax. A great examp= le > is the really irresponsible C-ism "if (i=3D1)...". While the error is > technically the programmers, the syntax rules are just asking for humans = to > make that mistake. > > In these two cases at least, Pascal gets it a lot more right than C. In > Pascal: > > if outer_condition then > if inner_condition then count :=3D 1; > else > ... > > Would generate a syntax error because the ";" ends the IF statement and E= LSE > therefore is not valid there. > > In the second case, the assignment operator is ":=3D" whereas "=3D" is a > statement of equality: > > if i =3D 1 then ... > > does exactly what most people reading it would think. If you actually wr= ote > > if i :=3D 1 then ... > > then you'd get a compile error since a assignment statement isn't allowed= as > the condition expression of a IF statement. > > Language design *does* matter. Unfortunately C is badly designed but so > many people have gotten used to it they have become blind to the problems= .. > > > ******************************************************************** > Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products > (978) 742-9014. Gold level PIC consultants since 2000. > =20 --=20 Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.289 / Virus Database: 267.11.13 - Release Date: 10/6/05 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .