Title
Namespaces and extern "C"
Status
nad
Section
9.11 [dcl.link]
Submitter
Steve Clamage

Created on 2002-05-28.00:00:00 last changed 261 months ago

Messages

Date: 2002-10-15.00:00:00

Notes from October 2002 meeting:

Yes, this example is valid. See 9.11 [dcl.link] paragraph 6, which contains a similar example with the definition in the global namespace instead. There is only one f, so the question of whether the definition is in the global namespace or the namespace N is not meaningful. The same function is found by name lookup whether it is found from the declaration in namespace N or the declaration in the global namespace, or both (9.8.4 [namespace.udir] paragraph 4) .

Date: 2004-09-10.00:00:00

Is this code valid:

  extern "C" void f();

  namespace N
  {
    int var;
    extern "C" void f(){ var = 10; }
  }

The two declarations of f refer to the same external function, but is this a valid way to declare and define f?

And is the definition of f considered to be in namespace N or in the global namespace?

History
Date User Action Args
2002-11-08 00:00:00adminsetmessages: + msg784
2002-11-08 00:00:00adminsetstatus: open -> nad
2002-05-28 00:00:00admincreate