1. 63
  1.  

  2. 30

    The file is light on rationale but the reason for each addition is detailed in the commit log

    1. 7

      Clang has a flag that will emit warnings for some of these (the string functions for sure.)

      It occurs to me that there ought to be a safer/saner string library for C, sorta like a C API for C++ std::string. It’s too bad such a thing never caught on.

      1. 6

        Sds is 99% of the way there. The remainder you would need language support for.

      2. 6

        that reminds me of the banned.h from MS during the SDLC buzz times, the old links are not working anymore, but here is copy: https://github.com/x509cert/banned/blob/master/banned.h

        1. 1

          I’ve never seen preprocessor directives tabbed like that before, is that standard?

          1. 1

            While most code is not like this, it’s not uncommon.

            1. 1

              Yes. The standard requires that the first character of the line be a # to be recognised as a preprocessor directive (so it’s trivial for the preprocessor to differentiate between directives and source code) and then follows the normal C tokenisation rules, where # is a token, include is a token, pragma is a token and so on. C allows an arbitrary amount of whitespace between tokens (e.g. ++ i and ++i are equivalent).

              This is the only way of indenting preprocessor directives that is actually allowed by the standard. clang-format will happily do this for you.

          2. 0

            I cannot decide if this is a good or a bad thing. More power to those who find it useful, personally I don’t.