On 2011-02-18 at 09:22:36 [+0100], Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote: > Stefano Ceccherini<stefano.ceccherini@xxxxxxxxx> wrote: > > 2011/2/18 Michael Pfeiffer <michael.w.pfeiffer@xxxxxxxxx>: > > >> Although I think I've seen this kind of style used a lot of times by > > >> Ingo, Axel, Stephan, and I actually used it too. > > > I just quoted the rule, it should be removed from the guidelines if > > > it is not valid. > > Of course, I agree. > > It should only be changed to allow this specific use case, Well, it kind of does, since this is an initialization, not an assignment. :-) > as this actually > helps to write cleaner code (when you know the idiom, it's very easy to > read). > However, things like: > if ((status = file.SetTo(...)) == B_OK) > > should still be avoided. I'd only agree to that for simple if's like that. Sometimes it is rather handy to put multiple of such assignments + checks in a single condition to avoid deeper nesting or unnecessarily longish code. E.g. if ((error = message.FindString(...)) != B_OK || (error = message.FindString(...)) != B_OK ... || (error = message.FindString(...)) != B_OK) { return error; } is much more compact and easier to read than the alternatives. CU, Ingo