On Tue, 11 Feb 2003 10:01:37 +0100, Horst von Brand said:
> > > > > - for (i = 0; i < clone_list[i].vendor_id != 0; i++)
> It isn't, as written. Something is very wrong in any case, as it should
> have blown up somewhere before.
Well, currently, there's only like 3 entries in the table - two clones
and a null. So for i=0 and i=1, 'i<vendor_id' happens to be true, and we
compare that to a zero. Then for i=2, i is greater than the terminating
null in the table, and we compare THAT to zero.
> In any case, the != 0 is redundant, idiomatic C is to just go:
>
> for (i=0; clone_list[i].vendor_id; i++) {...
True. Notice I said "what was intended", not "what is idiomatic". ;)
-- Valdis Kletnieks Computer Systems Senior Engineer Virginia Tech
This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:32 EST