Internal static variables in C, would you use them?

后端 未结 13 1443
甜味超标
甜味超标 2020-12-07 19:09

In C you can have external static variables that are viewable every where in the file, while internal static variables are only visible in the function but is persistent

相关标签:
13条回答
  • 2020-12-07 20:06

    I wouldn't want the existence of a static variable to force me to put the function into its own file. What if I have a number of similar functions, each with their own static counter, that I wanted to put into one file? There are enough decisions we have to make about where to put things, without needing one more constraint.

    0 讨论(0)
提交回复
热议问题