Uri Habusha wrote: > Hi Stan, > > I don't understand what is the problem with the variable > initialization. I think it's safer and more code robust to set a > default value to variable. > > I know it is theological argument, so I prefer to leave it to the > developer decision, if the code is valid.
Extra instructions executed for no purpose as the results are never used and over-written in the next statement. Additionally extra code space consumed by useless instructions - granted it is not that much. All in all, it's sloppy coding. stan. > > Uri > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Smith, Stan > Sent: Tuesday, August 31, 2010 8:08 PM > To: Tzachi Dar > Cc: [email protected] > Subject: [ofw] [PATCH] remove useless variable initialization > > > Remove useless variable initialization. > > signed-off-by: stan smith ([email protected]) > > --- a/inc/kernel/shutter.h Tue Aug 31 10:03:12 2010 > +++ b/inc/kernel/shutter.h Tue Aug 31 09:53:34 2010 > @@ -51,7 +51,7 @@ > > static inline void shutter_sub(shutter_t * p_shutter,long Val) > { > - long res = 0; > + long res; > ASSERT(Val < 0); > res = InterlockedExchangeAdd( &p_shutter->cnt,Val ); > if ((res+Val) == -MAX_OPERATIONS) > @@ -61,7 +61,7 @@ > // if RC == true, one can proceed > static inline BOOLEAN shutter_add(shutter_t * p_shutter,long Val) > { > - long res = 0; > + long res; > ASSERT(Val > 0); > res = InterlockedExchangeAdd(&p_shutter->cnt,Val); > ASSERT(res <= MAX_OPERATIONS); > @@ -93,7 +93,7 @@ > > static inline void shutter_shut(shutter_t * p_shutter) > { > - long res = 0; > + long res; > // > // ASSERT not calling shu twice. > // > _______________________________________________ > ofw mailing list > [email protected] > http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw _______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
