3 ms·
if ((options == (__WCLONE|__WALL)) && (current->uid = 0)) retval = -EINVAL; > ...A casual reading by an expert would interpret this as innocuous error-
by Stratoscope 13y ago
if ((options == (__WCLONE|__WALL)) && (current->uid = 0))
retval = -EINVAL;
> ...A casual reading by an expert would interpret this as innocuous error-checking code...
Wait... Wait... A casual reading by any expert should result in the question "why is this code setting current->uid to 0?"
After all, in case said expert has forgotten the difference between = and ==, this little bit of code all by itself has two correct reminders about what those operators actually do.
- derleth 13y agoEven better: Emacs has cwarn-mode, which by default highlights = (assignment-equal) in tests in BRIGHT RED. I'm sure Vim has something similar; maybe the customized version of uEmacs/PK 4.0.15 Linus uses does not. http://www.emacswiki.org/emacs/CWarnMode http://www.emacswiki.org/emacs/CWarnMode http://en.wikipedia.org/wiki/MicroEMACS http://en.wikipedia.org/wiki/MicroEMACS http://web.archive.org/web/20061124122032/http://www.stifflog.com/2006/10/16/stiff-asks-great-programmers-answer/ http://web.archive.org/web/20061124122032/http://www.stifflo...
- annnnd 13y agoMost IDEs do that today - but I wonder how many did that in 2003?
- andyhmltn 13y agoAlthough I noticed it judging by the amount of times I've fell for those 'check the error in this sentence' games I would assume that if you're reading a lot of code and you see the 'if' you would subconsciously interpret it as two equals signs.