In which version of C was the problem of = and == solved?
This is a discussion on Assignment operator in C within the C Programming forums, part of the General Programming Boards category; In which version of C was the problem of = and == solved?...
In which version of C was the problem of = and == solved?
You don't need to spam up our board with pointless and naïve questions. Are you trying to take a test or something?
And what are you even talking about? There was never a problem with = and ==.
What is your question specifically?
Sorry I misread the criticism section of C in wikipedia so the misconception.
Look, I won't criticize you. Just please rephrase your question as it doesn't make any sense now.
The first 90% of a project takes 90% of the time,
the last 10% takes the other 90% of the time.
Except that you cannot always write the condition in that way since you may be comparing two non-const lvalues... unless you're really suggesting always ensuring that the left hand side is an rvalue or non-const lvalue, but if you can always remember that, then you can always remember not to use = when you mean ==.Originally Posted by vart
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
or you can remember to use compiler which actually warns about using assigning operator inside if![]()
The first 90% of a project takes 90% of the time,
the last 10% takes the other 90% of the time.
It becomes a problem when I actually want to do an assignment and a boolean check at the same time. I wouldn't want future code maintainers to panic when those warnings pop up... possibly causing them to think I didn't know what I was doing.
O_o
(1): I submit that if your "maintainers" don't understand the definition of "false positive" they shouldn't be maintaining anything.
(2): If your company standard has such extremes as "no warnings allowed even false positives" you shouldn't be combining assignment with the check in the first place.
Soma
Heh, I was waiting for someone to tell me I was just coding wrong. Something likeCompiler would whine telling me to dumb down my code. Oh well.Code:if (fp = fopen(...)) { /* do good stuff since file open succeeded */ }
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"