News for hackers. Stuff that matters.
Re:C’s Biggest Mistake (2009) by WalterBright on Sunday September 13, 2020 @05:10PM (#24463977)
> misinterpret the meaning of a variable named `size`

Quite right. I use, and highly recommend, the convention that `size` is for number of bytes, `length` is for number of elements, and `capacity` for the allocated number of elements.

    assert(length * sizeof(element) == size);
    assert(length <= capacity);

There are no comments on this comment yet.