DMD 1.019 and 2.003 releases
fraserofthenight at gmail.com
Tue Jul 24 17:55:41 PDT 2007
> BCS wrote:
> > Reply to 0ffh,
> >> BCS wrote:
> >>> Reply to 0ffh,
> >>>> [...]
> >>> [...]
> >> [...]
> > Never to my understanding. However this is a good reason to do the more
> > verbose one in that the compiler gets more info and then can use that
> > for optimization (maybe).
> Well, if we agree the semantics are identical, then so is the info the
> compiler has (phew, I'm glad that this works both ways...).
> > That however is more of a general rule rather than just for this case.
> I accept it as a general rule. =)
> Kind regards, Frank
There was a discussion of this on digitalmars.D recently. While that syntax works fine for most cases, it doesn't work in (non-static) asserts for aggregate types with invariants: assert(obj) runs the object's invariant() method, which will segfault if the object is null instead of giving a nice assertion failure.
"if(x != 0)" is just more explicit than "if(x)", but not many people use "if(b != false)" (unless you're that guy where I wrote who wrote "while(m_userSubscribed == Boolean.FALSE.booleanValue())", which I sincerely hope wasn't sincere), so being concise isn't bad as long as you're meaning is clear. I think it looks ugly in for loops, though:
for(int i = 100; i; i--) // Takes a second to mentally figure out what's going on
More information about the Digitalmars-d-announce