[PATCH] Fix an endless loop in OSPF

Martin Mares mj at ucw.cz
Thu Sep 4 15:21:52 CEST 2003


Hi!

> -  u8 i,twoway,oldpriority;
> +  u32 i;
> +  u8 twoway,oldpriority;

I think that using types smaller than int for any local variables except
structures and arrays is very impractical and should be avoided -- not
only you risk problems of this type, but it's also in many cases slower
[every time you do any arithmetic on them, they get automatically
promoted to int and although the compiler is able to optimize out many
of these promotions, many others remain].

It would be probably better to replace any u8's and u16's used for loops
by unsigned int's.

				Have a nice fortnight
-- 
Martin `MJ' Mares   <mj at ucw.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
We all live in a yellow subroutine...



More information about the Bird-users mailing list