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]
Other format: [Raw text]

Re: C++ PATCH: PR 9924


On Wed, 12 Mar 2003 20:40:24 -0700 (MST), Roger Sayle <roger at www dot eyesopen dot com> wrote:

> I'd be the last person to argue the current situation is ideal.  Please
> remember that all four of g++'s schemes for handling builtins in predate
> my involvement.  Infact the situation got so out of control, that the
> g++ front-end maintainers just completely disabled built-ins for 3.0,
> prior to my first GCC patch submission.  I'm just the poor sole trying
> to pull things back into some sort of shape.

Yes, and I very much appreciate it.

> Its not that I disagree with a strategy that recognizes declarations
> as they're defined, its just that's no-one's written or even proposed
> a workable solution along those lines.

When we were discussing implementation before your overhaul, I advocated
extending the nothrow_libfn_p mechanism to cover all built-in knowledge of
C library functions.

> And the current mechanisms for "builtin declaration recognition" in g++
> are remarkably inefficient.  Linear searches vs. the hash-table
> identifier lookups for duplicate declarations.

nothrow_libfn_p uses a perfect hash.  Admittedly, it's an additional
lookup, but I doubt it's a major bottleneck.

> Remember that C++ has to lookup duplicate declarations anyway, so this
> bit is free, even if the spagetti-code in cp/decl.c's duplicate_decls is
> an error-prone nightmare.  The equivalent code in C, java and FORTRAN is
> also ugly, but C++'s is particularly buggy.

Agreed.

> Nobody's even commented on my suggestion of using the PCH machinery
> to efficiently preload the builtins DECLs from iso90.gch, iso99.gch
> or a g++.gch.

I think that the PCH machinery only supports a single monolithic PCH per
compile, so such a scheme would preclude, say, a libstdc++ PCH.

> My long term dream is that some day g++ will convert "v.size() == 0"
> into "v.empty()" where v is any of the standard STL container templates,
> such as std::vector<T>.  Our current infrastructure is so far from
> being able to handle this, its almost science fiction.

Yep.  The predeclaration strategy just won't work for member functions.

Jason


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