why making unit static makes internal linkage

54 views Asked by At

Can anyone explain why making function static in C++ makes it internally linked only. Is that just from plane standard or some language trick?

1

There are 1 answers

2
Pete Becker On

static can be confusing, because it has a few different meanings depending on context. In this context, it means that the variable being defined is visible only in the current translation unit:

int i;        // visible in all translation units
static int j; // visible only in the current translation unit