• henfredemars@infosec.pub
      link
      fedilink
      English
      arrow-up
      26
      ·
      16 days ago

      strtok is a worst offender that comes to mind. Global state. Pretty much just waiting to bite you in the ass and it did, multiple times.

      • mormegil@programming.dev
        link
        fedilink
        arrow-up
        12
        ·
        edit-2
        11 days ago

        Sure, strtok is a terrible misfeature, a relic of ancient times, but it’s plainly the heritage of C, not C++ (just like e.g. strcpy). The C++ problems are things like braced initialization list having different meaning depending on the set of available constructors, or the significantly non-zero cost of various abstractions, caused by strange backward-compatible limitations of the standard/ABI definitions, or the distinctness of vector<bool> etc.

        • henfredemars@infosec.pub
          link
          fedilink
          English
          arrow-up
          3
          ·
          16 days ago

          No you are right! Honestly it was several years ago and I struggled to remember exactly what I came up with before I left.

          In our application we for example never use dynamic memory allocation. It has to be done very carefully so we don’t crash. Problem is there’s lots of sneaky ways one can accidentally do it from the standard library.