This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [C++ PATCH] Fix extern "C" function and namespace handling



On Sat, 7 Oct 2000 brent@rcfile.org wrote:

> On 07 Oct 2000 at 01:25 (-0400), brent@rcfile.org wrote:
> 
> well, mostly :) 
> The following does not compile -- it should.
> 
> namespace _C_ { 
>   extern "C" int abs(int a); 
> }
> using ::_C_::abs;
> 
> int main()
> {
>   return 0;
> }
> 
> dust$ Compile n.cc
> g++ -g -Wall -I. -DDEBUG_ASSERT n.cc -o n 
> n.cc:4: `abs' is already declared in this scope

It's just that the abs builtin function was silently declare
in the global scope.  So the using declaration catches this
error.  Builtin functions can be moved to their own namespace 
now as namespace doen't matter for C linkage functions anymore.  

I haven't looked at the relevant codes in gcc to decide which 
part should be modified yet.  It should be sorted out in a few
days.

--Kriang


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]