On Tue Jun 13 11:34:09 2023 +0000, Henri Verbeet wrote:
Regarding if () {} else {} style, it's nothing but a matter a taste in
my opinion. I don't care at all about that part, meaning I'll using whichever is preferred. I'd think more about it being consistent, if there is a broad agreement to use this style, maybe we could add formatting config file to make it clear. To make the discussion more interesting, I'm generally on the opposite side of this. I.e., generally preferring
if (condition) return f(); return g();
and particularly
if (condition1) return f(); if (condition2) return g(); return h();
over the alternatives. A large part of that is simply the fact that "else" after "return" is redundant. That said, while I'm happy to give my opinion on code style, I'm not a major contributor to the HLSL compiler at this point, and I've largely left it up to the people who are to figure out between themselves, provided it doesn't deviate too egregiously from the broader vkd3d style.
Of course I don't want this issue to become too predominant, given that it's just a matter of taste. I mentioned it mostly because at some point I thought my suggestions was somewhat aligned with Zeb's tastes too (but I could be wrong).
My point, though, is not really about the `else` (which I still prefer to have, if the two branches are somewhat symmetrical), but rather the fact of "hand-inlining" the default helper. I.e., I consider this a little suboptimal: ```c if (condition) return f(); return g(); ``` but I consider this significantly worse: ```c if (condition) return f(); // inline g here ``` (though, in the end, acceptable)