I agree with the general idea of this thread. In my opinion, integer widths should only be specified in cases where the developer needs to know the exact width, for example in network protocols or when interfacing with hardware. In normal program logic the variables should be using the general types, such as int, long, double, or size_t. This goes for code in general, not just iterator variables.
Best regards, Joakim On Fri, Oct 14, 2016 at 10:05 AM, Oleg Hahm <oliver.h...@inria.fr> wrote: > Hi Kees! > > On Fri, Oct 14, 2016 at 08:05:51AM +0200, Kees Bakker wrote: > > On 13-10-16 22:42, Kaspar Schleiser wrote: > > > On 10/13/2016 09:43 PM, Kees Bakker wrote: > > > > > > Does anybody object to adding this to the coding > > > > > > > > conventions explicitly? > > > > > > What about `size_t`? > > > > +1 for size_t > > > Well, any convention would need careful wording. > > > > > > ``` > > > for (uint32_t timeout = 1; timeout < (10LU*1000*1000); timeout *= 2) { > > > if(try()) break; > > > } > > > ``` > > > > > > ... cannot blindly by convention converted to size_t as loop variable. > > > > Of course not. > > But I believe the question was more, in case of an unsigned type, > > should we use "unsigned int" or size_t. In that case I would go for > size_t. > > No, the initial question was whether we should recommend (unsigned) int (or > (s)size_t) as loop iterator variable types. > > Cheers, > Oleg > -- > printk(KERN_WARNING "%s: Thanks, I feel much better now!\n", dev->name); > linux-2.6.6/drivers/net/de620.c > > _______________________________________________ > devel mailing list > devel@riot-os.org > https://lists.riot-os.org/mailman/listinfo/devel > >
_______________________________________________ devel mailing list devel@riot-os.org https://lists.riot-os.org/mailman/listinfo/devel