Code like Yoda, you must not.
Of course, I'd use if(!flag)
This is a semantic issue that doesn't even go away in pseudocode.
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'
endI think that
if(S_OK == QueryInterface(IID_IUnknown, &p)) {
is clearer than if(QueryInterface(IID_IUnknown, &p) == S_OK) {