This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c++/12629] name leaks


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12629



------- Additional Comments From gdr at integrable-solutions dot net  2003-10-20 19:11 -------
Subject: Re:  name leaks

Yujie Wu <yujie.wu@hec.utah.edu> writes:

| Thanks for your comments. In fact, it is a VALID C++ program accroding
| to the C++ standard:  All C-library functions in C++ should be wrapped
| into `std' namespace rather than staying in the global namespace as in C.

The program is NOT valid.  Here is why:

17.4.3.1.3/4

  Each name from the Standard C library declared with external linkage
  is reserved to the implementation for use with extern "C" linkage,
  both in namespace std and in the global namespace. 

| Whatever linkages those function have is the business of the compiler,
| which should deal it in the way the standard says (if it wants to be a
| compliant compiler).

The issue is not that simple.  See above.  The reason is that if a
function is declared as having a C linkage then *all* declarations of
the same function in *any* namespace refer to the *same function*.
Therefore your definition of ::exit is ill-formed.  

-- Gaby


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