This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Default arguments and FUNCTION_TYPEs
"Giovanni Bajo" <giovannibajo@libero.it> writes:
| Nathan Sidwell <nathan@codesourcery.com> wrote:
|
| >>> In the C++ front end, default arguments are recorded in
| >>> FUNCTION_TYPEs intead of being part of the FUNCTION_DECLs. What are
| >>> the reasons for that?
| >>
| >>
| >> There used to be an extension that allowed default arguments on
| >> function pointer types. We agreed to kill it, although I don't know
| >> if it was actually removed. If that's been done, there's no longer
| >> any reason.
| >
| > I took it out the back and shot it.
| >
| > The obvious place is on the DECL_INITIAL of the PARM_DECLs, but I
| > don't think they exist until the function is defined.
|
|
| I heard once that there was some long-term project of storing function
| declarations (without corresponding definitions) in a more memory-efficient
| memory representation. Moving default parameters within PARM_DECL seems a
| little backward in this respect. And if your memory is right, requiring to
| build PARM_DECLs just to store default arguments would be even worse.
I don't see why, it is backward -- we still need to build the
PARM_DECLs default arguments or not. Anyway, I'm in the middle of
coding that suggestion, so I would appreciate a better concrete
representation.
-- Gaby