Any preference on using braces to restrict scope?
José Matos
jaomatos at gmail.com
Fri Nov 18 18:14:01 UTC 2022
On Fri, 2022-11-18 at 18:43 +0100, Thibaut Cuvelier wrote:
> You can avoid this level of indentation by defining the variable
> within the if:
>
> if (const vector<docstring> potential_terms =
> getSubentriesAsText(runparams); !potential_terms.empty()) {
>
> I don't really like this syntax, because it makes extremely long
> lines, but it has strong advantages.
This helps a bit:
if (const auto potential_terms = getSubentriesAsText(runparams);
!potential_terms.empty()) {...}
Using const auto and aligning the condition with the opening
parenthesis.
FWIW I think that using curly brackets just to define the variable's
scope is ugly. :-) This is an aesthetic opinion but the issue is also
just aesthetic. :-D
Best regards,
--
José Abílio
More information about the lyx-devel
mailing list