On Fri, Nov 18, 2022 at 06:43:38PM +0100, Thibaut Cuvelier wrote:
> On Fri, 18 Nov 2022 at 18:41, Scott Kostyshak <skost...@lyx.org> wrote:
> 
> > What do you think of the attached patch? It adds braces to restrict the
> > scope of the variable 'potential_terms'. I like this style, since it
> > makes it easier for me to read, but I wonder if others would find it
> > annoying. For example, it adds an extra layer of indentation.
> >
> 
> 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.

Thanks, Thibaut. I agree that the syntax is strange. Perhaps once I got
used to it, it would indeed be the simplest way to reduce the scope. In
any case, I'm glad to know this alternative since I indeed was not aware
of it before I saw it in the code.

Scott

Attachment: signature.asc
Description: PGP signature

-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to