[PATCH] Refactoring based on cppcheck suggestions

Richard Kimberly Heck rikiheck at lyx.org
Mon Oct 5 15:33:29 UTC 2020


On 10/5/20 11:06 AM, Scott Kostyshak wrote:
> 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.
Sometimes, I have thought that something like

    bool const fileExists = ...;
    return fileExists;

would help. This is 'self-commenting' code, but a simple comment would
also help.

Riki




More information about the lyx-devel mailing list