← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Clang warning removal

 

> Date: Sat, 19 Apr 2014 17:44:25 +0200
> From: l.marcantonio@xxxxxxxxxxxx
>
> On Sat, Apr 19, 2014 at 04:02:21PM +0200, Camille 019 wrote:
>> * /pcbnew/router/direction.h:293:19: warning: comparison of constant 8 with expression of type 'DIRECTION_45::Directions' is always false [-Wtautological-constant-out-of-range-compare]
>>         if( m_dir>= 8 )
>>             ~~~~~ ^  ~
>
> At last C++ compilers advance to the type checking of CL or other
> functional languages :D
>
> Be sure to check that there is *no casting* on things put in that m_dir
> slot, otherwise you could actually find stuff>= 8 in there

I wrote this patch just to silence the warning.
A second algorithm without any cast is present in the code of DIRECTION_45::construct() but is not used, I don't know why.

> Type safety in this project was/is a little... underrated:P
>
> --
> Lorenzo Marcantonio
> Logos Srl
 		 	   		  

References