Any preference on using braces to restrict scope?

Pavel Sanda sanda at lyx.org
Mon Nov 21 14:12:17 UTC 2022


On Mon, Nov 21, 2022 at 02:54:42PM +0100, Thibaut Cuvelier wrote:
> On Mon, 21 Nov 2022 at 10:14, Jean-Marc Lasgouttes <lasgouttes at lyx.org>
> wrote:
> 
> > Le 18/11/2022 ?? 18:43, Thibaut Cuvelier a écrit :
> > > 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.
> >
> > I think this is C++17-only syntax.
> >
> 
> According to https://stackoverflow.com/a/12655339/1066843, it's C++98. At
> least, people were discussing it in 2012.

I think they refer to:
if (int x=f())
while we speak about e.g.
if (int x=f(); x > g() )

Pavel


More information about the lyx-devel mailing list