4 ms·
All variables declared at file scope have static storage duration in C.
by caf 9y ago
All variables declared at file scope have static storage duration in C.
- pjmlp 9y agoI was talking about using static keyword.
- caf 9y agoYes, but what's important here is the storage duration, which the static keyword doesn't affect at file scope (it just affects the symbol scope).
- jmaygarden 9y agoUse of static in the context of that C snippet is deprecated in C++. One is supposed to use an unnamed namespace instead. namespace { int myfunc() { return 5; } int x; int y = 4; int z = myfunc(); }; int main() {} In my opinion, his point is still valid.
- j4_james 9y agoJust FYI, I believe that deprecated usage was later undeprecated. See https://stackoverflow.com/questions/4726570/deprecation-of-the-static-keyword-no-more https://stackoverflow.com/questions/4726570/deprecation-of-t...