• @[email protected]
    link
    fedilink
    120 hours ago

    I don’t need to Google anything. I have 30 years experience writing C & C++.

    This is not about storage durations

    Yes it is.

    https://en.cppreference.com/w/c/language/storage_duration

    it’s local to a function

    Only the visibility is local. The data is still global state. You can call that function from anywhere and it will use the same state. That’s what global state means.

    https://softwareengineering.stackexchange.com/a/314983

    Some of the biggest issues with global state are that is makes testing difficult and it makes concurrent code more error-prone. Both of those are still true for locally scoped static variables.

    • @[email protected]
      link
      fedilink
      1
      edit-2
      16 hours ago

      Again, it’s an easy refactor to make it not global. There are cases where that extra abstraction work simply does not add value.

      With your background, you should know that