cg@myrias.UUCP (Chris Gray) (01/20/88)
I am one of the people who have trouble with accidentally using = instead of ==. (I once actually used == instead of = in an assignment statement too.) My problem is not lack of experience with C - I've used it for 10 years or so, and have written tens of thousands of lines of C, including an ANSI C compiler. My problem stems from the fact that I also program at home on my Amiga, using a compiler of my own (Draco), which uses = for comparison and := for assignment. Thus, I switch back and forth between the two styles on a daily basis. My hardest day is monday, after a whole weekend of using the other style. I don't have problems going in the other direction because the compiler at home is helpful and points out my silliness to me, unlike the C compiler at work which blithely ignores it. I'll be glad when we switch to our own target machines for development, so that I can use our compiler, which by default warns of those cases which appear dubious (the true C hacker will of course make an alias to disable that option). -- Chris Gray Myrias Research, Edmonton +1 403 428 1616 {uunet!mnetor,ubc-vision,watmath,vax135}!alberta!myrias!cg
gwyn@brl-smoke.ARPA (Doug Gwyn ) (06/26/88)
In article <4593@killer.UUCP> richardh@killer.UUCP (Richard Hargrove) writes: >I think we need to start the "= vs. ==" discuusion up again. It's been >dormant for about six weeks now... ;-) Oh, my, we can't allow that.. How about <- for assignment, and -<- for what is usually called -=? Then we could write statements such as p->q---<-q->r---<---s; which is obviously quite readable :-| Gee, why isn't C different from what it is?
selitr@jackal.cs.wisc.edu (Sean Selitrennikoff) (09/19/90)
Look, it really is a matter of semantics. The problem arises in that most of the complainers out there started in PASCAL where if (a = b) is a test. Then we switched to C and it became a pain in the parse. In any case, if we had never learned PASCAL (or other language with '=' as a test) then we wouldn't be having this convo. Personally I think every C compiler ought to have a switch -DUM_DUM that checks for idiot errors and pops out a warning for them. That would solve all these errors that we make that are typo's. e.g. for (i=0;i<10;i++); printf("%d",i); I hate it when the loop does nothing. We're so used to putting ';' at the end of every line. I musta wasted days on things like this. In any case, it's all a part of the hacking experience. What would life be if you couldn't spend days looking for a bug only to have some dweeb peer over your shoulder and find it immediately? You oughta try teaching PASCAL 6 times a week and then trying to write a compiler in C. That'll make you smile/grunt/groan several times a week. Bottom Line: Let it be. That's the way it is, all we can do is build our own 'lint' that catches our idiot errors. - a minor opinion from someonw with a minor mind. sean