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]

Re: enums in C++


Nathan Sidwell <nathan@codesourcery.com> writes:

> Remember, stuff inside `extern "C" { ... }' must still be valid
> C++. Also remember, the set of overloaded functions named `foo' must
> have distinct parameters, only one of the set can have C linkage.

Yes, it must be valid C++ but the rules must be relaxed.  It must be
possible to call the functions the way you can do this in C.  If a
function is defined which C linkage we already have to treat certain
things special and I think enum belong into this category.  Their
handling is much more relaxed in C and this is what people are using.

It simply does not help insisting that they write C++.  You have to
use C libraryies at some point and then you have to use their
interface.  If the interface is defined using enum of bit values then
people can reasonably expect it to work just as in C.

This is apparently how other C++ work.  Otherwise this code wouldn't
be in such wide use.  At least relax the rules when using
-fpermissive.

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

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