The if(0==flag) is perfectly valid for avoiding if(flag=0) bugs.
Of course, I'd use if(!flag)
Of course, I'd use if(!flag)
Any non-modern language should flag a warning on that. And this warning should be set to be an error by any reasonable developer.
Flash Builder's Actionscript compiler has saved me from that a couple times in memory, though, so I agree it should be a warning if you don't wrap it in extra parens. gcc also will complain.
The problem with := is that you run the risk of the Pascal trap, in that no language which uses := for assignment has ever become more popular than Pascal.
This is how you set default values for optional argument in Ruby and is very common.
if(@post = Post.find(params[:id]))
render @post
else
render 'Post not found'
endThis is a semantic issue that doesn't even go away in pseudocode.