[C++] Deprecating default arguments on function types

Jason Merrill jason@redhat.com
Mon Jul 21 18:49:00 GMT 2003


On 21 Jul 2003 15:20:24 +0200, Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

> Nathan Sidwell <nathan@codesourcery.com> writes:
>
> | Can we deprecate
> | 	typedef int (*P) (int = 1);
> | 	int f (P p) { return p ();}
> | ?
>
> Mark already deprecated something like
>
>    int f(int, int = 0);
>
>    int(*p)(int) = &f;

I don't think we ever supported code like that; it would require some sort
of thunk.

WRT Nathan's question, I still think that it makes sense to have default
args on, say, function pointers, but it certainly doesn't seem to have
caught the imagination of the C++ community, so it's probably not worth
retaining as an extension.  I think one of our customers still uses this
extension, but I've never heard of anyone else doing so (and they're stuck
on a 1998-era compiler for other reasons).

Jason



More information about the Gcc mailing list