Skip to content

Instantly share code, notes, and snippets.

@depp
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save depp/22a71901c9dc515f6377 to your computer and use it in GitHub Desktop.
Save depp/22a71901c9dc515f6377 to your computer and use it in GitHub Desktop.
As you can see, only extern_func() is accessible from other translation units.
$ c++ -std=c++11 -c test.cpp
$ nm -g test.o | c++filt
0000000000000000 T extern_func()
$ nm test.o | c++filt
0000000000000000 T extern_func()
0000000000000006 t static_func()
000000000000000c t (anonymous namespace)::anonymous_namespace_func()
void extern_func() { }
static void static_func() { }
namespace { void anonymous_namespace_func() { } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment