> On May 2, 2018, at 4:58 PM, Davide Italiano <dccitali...@gmail.com> wrote: > > On Wed, May 2, 2018 at 4:56 PM, Davide Italiano <dccitali...@gmail.com> wrote: >> On Wed, May 2, 2018 at 4:51 PM, Jason Molenda via lldb-commits >> <lldb-commits@lists.llvm.org> wrote: >>> Is this really simpler? We could write it >>> >>> if (name == g_zero) >>> return 0; >>> else >>> return UINT32_MAX; >>> >>> or we could do it that way, or it could be done the way it was originally >>> written. >>> >>> tbh it seems like a style choice, and whoever wrote it originally may have >>> preferred it being expressed that way. I can understand that you prefer it >>> be expressed this way - but it's not actually any better or more readable, >>> is it? Certainly the compiler is going to turn any variation we can come >>> up with into the same instructions. >>> >> >> Oh, I guess I should've said "make this code shorter" or something :) >> We end up preferring ternary in llvm whenever possible, and I just >> followed what was used there. >> I largely agree it's a stylistic choice, FWIW. >> > > Also, I don't necessarily mind reverting this, as long as we agree on > a style to follow.
Personally I think if-else is a lot easier to read than the ternary operator here. The original author thought that if (name == g_zero) return 0; return UINT32_max; was more readable than if-else - we all have personal preferences. I think the llvm style guides may have picked, imo, the least readable of the three alternatives. I won't be making changes to the codebase like this, but its up to each of us to do what we think improves the project the most, so. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits