tags:

views:

52

answers:

2

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?

A: 

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

deinst
@deinst:"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" ?
Jinx
@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