News for hackers. Stuff that matters.
Re:Const all the things? by bluetomcat on Monday January 24, 2022 @04:20AM (#30055173)
With the const-everywhere approach, the code reads like it's in an SSA format and is dataflow-oriented. As an extreme example, the "len - 1" expression can be substituted with yet another const variable:

    const size_t len = strlen(s);
    if (len > 0)
    {
        const size_t len_minus_one = len - 1;
        s[len_minus_one] = '\0';
    }
The additional const "variables" also add another layer of self-documentation by virtue of their names.

There are no comments on this comment yet.