Created on 2002-05-28.00:00:00 last changed 279 months ago
Notes from October 2002 meeting:
Yes, this example is valid. See 9.12 [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.9.4 [namespace.udir] paragraph 4) .
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:00 | admin | set | messages: + msg784 |
| 2002-11-08 00:00:00 | admin | set | status: open -> nad |
| 2002-05-28 00:00:00 | admin | create | |