[riot-devel] Coding conventions amendment

Martin martin.landsmann at haw-hamburg.de
Wed Oct 12 17:35:27 CEST 2016

Am 10/12/2016 um 05:00 PM schrieb Oleg Hahm:
> Hi Martin!
> On Wed, Oct 12, 2016 at 04:52:37PM +0200, Landsmann, Martin wrote:
>>> On Wed, Oct 12, 2016 at 12:57:50PM +0200, Ludwig Knüpfer wrote:
>>>> Am 12. Oktober 2016 09:48:28 MESZ, schrieb Oleg Hahm <oliver.hahm at inria.fr>:
>>>>> as far I'm concerned it has been an undocumented coding convention so far
>>>>> to use `int` or `unsigned int` for iterator variables in a loop instead of
>>>>> fixed width integer types. Does anybody object to adding this to the coding
>>>>> conventions explicitly?
>>>> What about `size_t`?
>>> I don't see a reason against `size_t` - but also no good reason that speaks
>>> for it. What's the rationale?
>> size_t is suited best to be used for iterating array indices and never
>> overflow holding them [1].
>> [1] http://stackoverflow.com/a/2550799
> Sorry, I don't get this. Can you elaborate?
size_t is the type returned from sizeof() call that you may use to 
determine any object size (including length of static arrays),
so for my understanding the returned size_t value can not exceed the 
highest possible index for any array that can be allocated on the 
underlying platform.

But as Kaspar suggested we should probably state against using fixed 
width and only recommend size_t.
> Cheers,
> Oleg
> _______________________________________________
> devel mailing list
> devel at riot-os.org
> https://lists.riot-os.org/mailman/listinfo/devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20161012/781932eb/attachment-0001.html>

More information about the devel mailing list