[PATCH] Refactoring based on cppcheck suggestions
Scott Kostyshak
skostysh at lyx.org
Mon Oct 5 15:06:39 UTC 2020
On Mon, Oct 05, 2020 at 12:54:18PM +0200, Pavel Sanda wrote:
> On Mon, Oct 05, 2020 at 01:48:20PM +0300, Yuriy Skalko wrote:
> > > Ok, probably question of habit. When I see former three lines like above I
> > > immediately
> > > know what's going on. With new changes and I need to stop and start thinking
> > > what it does...
> > >
> > > Pavel
> >
> > Just look at the return expression as the answer to the question in
> > function name:
>
> No worries I can decode it, it's just that the previous pattern is already
> unconsciously hardwired in my brain, so I can process it faster ;)
> As other(s) seem to be ok with the change I am not going to fight it.
Same here. I also do not object to the patch, but my brain did take a
bit longer to parse the new version. For some reason my brain expects
"return" statements to be easy to parse so it gets upset when it has to
work for those. In contrast, it has no problem expecting that if
conditions can be non-trivial.
After thinking about it more though, I agree that the new version seems
to be better in terms of having only one return, although it's
interesting that some minor complexity (e.g., the cast or the explicit
comparison to nullptr) has to be added to achieve this in some cases.
Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20201005/7e1465f7/attachment-0001.asc>
More information about the lyx-devel
mailing list