Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Comes from the null==val idiom, and that comes from avoiding the popular "if (val=null)" bug in C/C++.

Sure, we could just admit that assignments in conditions are a permanently stupid idea. Instead, an entire industry backwards the conditions wrote.



I find initializing condtions like `if(Type variable = ...)` to be very nice in C++ to avoid excessive nesting while still keeping the variable scoped to the block. Of course, I also enable -Wparentheses for things like `if(val=null)`, which you get e.g. when using -Wall with both GCC and Clang.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: