This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Decorate C prototypes
- From: tom fogal <tfogal at alumni dot unh dot edu>
- To: Martin Sebor <sebor at roguewave dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 01 May 2009 21:21:42 -0600
- Subject: Re: Decorate C prototypes
- References: <20090422160718.GA30574@kam.mff.cuni.cz> <49EF5323.3080203@oracle.com> <49F0CF4A.7050805@codesourcery.com> <49FB2577.4040203@roguewave.com> <auto-000019281659@sci.utah.edu> <49FB393D.60806@roguewave.com>
- Reply-to: tfogal at sci dot utah dot edu
Martin Sebor <sebor@roguewave.com> writes:
> tom fogal wrote:
> > Martin Sebor <sebor@roguewave.com> writes:
> >> Mark Mitchell wrote:
> >> [...]
> >>> 2. We should verify that the compiler accepts
> >>>
> >>> extern "C" void abort(void);
> >>> namespace std {
> >>> extern "C" void abort(void) throw();
> >>> }
> >>>
> >>> and:
> >>>
> >>> namespace std {
> >>> extern "C" void abort(void) throw();
> >>> }
> >>> extern "C" void abort(void);
> >>>
> >>> That's important in case a user explicitly declares the function, or
> >>> #include's the C header.
> >> gcc 4.3.1 (the latest I have access to at the moment) does accept
> >> this even though it's ill-formed according to [except.spec], p2:
> >>
> >> If any declaration of a function has an exception-specification,
> >> all declarations, including the definition and an explicit
> >> specialization, of that function shall have an exception-
> >> specification with the same set of type-ids.
> >
> > Yes, but are those really the same functions? It seems to me like one
> > is `abort' and the other is `std::abort'. Without any sort of using
> > declaration, these are distinct ... no?
>
> They are one and the same function. According to [dcl.link], p6:
>
> At most one function with a particular name can have C language
> linkage.
Right.. that was exactly what I was inquiring about -- I thought these
*names* might be distinct. That said, the passage you reference also
includes a specific exception for this case:
Two declarations for an object with C language linkage with the
same name (ignoring the namespace names that qualify it) ...
so, yeah, I'm now convinced that these functions are the same; sorry
for the noise.
-tom