It is a bug/typo that just happens to work. There is no need to check for
\0. There used to be a comparison like "ch == clDecSep". Ugly but it should
be safe for now.

if( isDecSep( ch ) && sepCount )
   break;

should do the trick.

 - Michael


On Tue, Mar 13, 2018 at 11:10 AM, Jeff Young <j...@rokeby.ie> wrote:

> Yuck.  It’s clever code all right.  The “correct” version would be:
>
> if( !ch || ( isDecSep( ch ) && sepCount ) )
>    break;
>
> but it’s a whole 3 characters longer. ;)
>
> I’ll fix this in my 6.0 tree (which already has libeval re-formatted to
> Kicad standards), but I suggest we leave it sleeping for 5.0.
>
> Cheers,
> Jeff.
>
>
> On 13 Mar 2018, at 02:20, Jon Evans <j...@craftyjon.com> wrote:
>
> +Michael
>
> This looks like "clever" code so I can't tell if this is a bug or not
> without running through a bunch of test cases which I'm not going to do
> right now.
> Do you see any issues with the operation of the code, Mark, or just the
> warning?
>
> -Jon
>
> On Mon, Mar 12, 2018 at 9:28 PM, Mark Roszko <mark.ros...@gmail.com>
> wrote:
>
>> Not sure where to even begin looking at libeval since it looks scary but
>> MSVC complains:
>>
>> D:\kicad-source-mirror\common\libeval\numeric_evaluator.cpp(216):
>> warning C4805: '==': unsafe mix of type 'char' and type 'bool' in operation
>>
>> which is:
>>
>>       auto ch = clToken.input[clToken.pos];
>>       do {
>>          if (ch == isDecSep(ch) && sepCount) break;
>>
>>
>> ch is a char
>>
>> isDecSep returns bool
>>
>> char == bool?
>>
>>
>>
>> --
>> Mark
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>
>
>
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to