1

Possible Duplicate:
Why are unnamed namespaces used and what are their benefits?

namespace {

// EINTR sucks.
int close_no_eintr(int fd) {
  int result;
  do {
    result = close(fd);
  } while (result < 0 && errno == EINTR);
  return result;
}

In the code above, why there is not a name after namespace in the first line?

Community
  • 1
  • 1
  • Duplicate of [Why are unnamed namespaces used and what are their benefits?](http://stackoverflow.com/questions/357404/anonymous-namespaces) – James McNellis Aug 09 '10 at 02:38

1 Answers1

0

It is an unnamed namespace. It prevents names from leaking out of the current file, which they would do if declared as globals.

deinst
  • 18,402
  • 3
  • 47
  • 45
  • "Items defined in an unnamed namespace have internal linkage. Rather than using the keyword static to define items with internal linkage, define them in an unnamed namespace instead. " what is its meaning by "internal linkage" ? –  Aug 09 '10 at 02:50
  • @Jinx Linking internal to the file. As opposed to external linkage, which is linking to something in a different file. Look at the excellent answer to the question that this question was marked a dup of. – deinst Aug 09 '10 at 02:59